Ubuntu – Custom session: Window does not capture full screen area by default. 12.04

guest-sessionkioskpygtk

I am trying to create a custom session by creating a custom.desktop file in /usr/share/xesessions folder. Remember this is not a gnome or some other session. I have created my own application for this session, which are simple.

Case 1

Chrome Browser

Contents of custom.desktop file

[Desktop Entry]
Name=Internet Kiosk
Comment=This is an internet kiosk
Exec=google-chrome --kiosk
TryExec=
Icon=
Type=Application

Issue

Chrome browser starts in kiosk mode but does not capture complete screen area. Some area is left at the bottom and right side of the screen.


Case 2

Custom pyGTK app (Quickly)

Contents of custom.desktop file

[Desktop Entry]
Name=Custom Kiosk
Comment=This is a custom kiosk
Exec=~/MyCustomPyGTKApp
TryExec=
Icon=
Type=Application

Issue

My custom pyGTK app has window.fullScreen() in the code. That means it should open in full screen without the window chrome (and it does under the normal session). But that too, leaves lots of space around it.

Need Help

Can anyone tell me whats going on here. I think its some issue with borders as pointed out at http://www.instructables.com/id/Setting-Up-Ubuntu-as-a-Kiosk-Web-Appliance/?ALLSTEPS in Step 8

If by chance, Google Chromium is not stretched to the edges with the –kiosk switch enabled there is a simple fix. To stretch Chromium simply log in as your regular user and edit chromeKiosk.sh to not have the –kiosk switch. Then log in as the restricted user, click the wrench and choose options. Then on the Personal Stuff tab select Hide system title bar and use compact borders. Close the options screen and stretch Chromium to fit the monitor. Then go back into the options window and set it to Use system title bar and borders. After this is done, log out of your restricted user (might need to just reboot) and log into your regular user. Edit chromeKiosk.sh back to include the –kiosk switch again and Chromium should be full screen next time you log into the restricted user.

If I were to use a custom pyGTK or a gtkmm app, how should I get around this issue. window.fullScreen() should occupy the complete screen area. This has to be done programmatically or in some other way that can scale. I have to deploy this on large number of machines located at different geographical areas. Doing it manually on every machine is not possible.

Best Answer

This is a tricky one, I had a similar problem, when trying to have only a ncurses based interface on a time tracker pc, the problem for me was that when no window manager is present, normal X Window applications behave oddly. Here's my proposal:

  1. Install ratpoison window manager
    sudo apt-get install ratpoison
    
  2. Unbind keyboards that shows a menu or allows you to execute terminals or commands, putting this in $HOME/.ratpoisonrc the home being the user that will run the kiosk mode
    unbind c
    unbind C-c
    unbind exclam
    unbind C-exclam
    unbind period
    
  3. Instead of calling directly to google-chrome, put a script like instructables' link you mentioned
[Desktop Entry]
Encoding=UTF-8
Name=Kiosk Mode
Comment=Chromium Kiosk Mode
Exec=/usr/share/xsessions/chromeKiosk.sh
Type=Application
  1. On the script put this (remember to make it executable)
#!/bin/bash
ratpoison &
xscreensaver -nosplash &
while true; do chromium-browser --kiosk http://google.com; sleep 5s; done

Worked for me, with Ubuntu 12.04 and chromium.

Related Question