2

We build embedded systems based on ubuntu 14.04 in which we have implemented kiosk-mode type behavior by using a custom X session. Here is the desktop ffile defining the session:

[Desktop Entry]
Encoding=UTF-8
Name=Kiosk Mode
Comment=AppName Kiosk Mode
Exec=/usr/share/xsessions/appNameKiosk.sh
Type=Application

And here is the session script (appNameKiosk.sh);

#!/bin/bash

# Undefining the QT_QPA_PLATFORMTHEME environment variable disables the appmenu-qt5 package. That package is for putting
# the app menu up in the global bar rather than on the app. It has a bug and results in no menu anywhere. We want the
# menu on the app anyway.
export QT_QPA_PLATFORMTHEME=

metacity --replace &

# Set audio volume to max - user can reduce with physical knob if needed.
amixer set 'Master' 100%

# This sets the window decoration theme to our theme, which removes the title bar on maximized windows - hence on
# our main window.
gsettings set org.gnome.desktop.wm.preferences theme AppName

while true; do
    ~/AppName/bin/AppName.sh --kioskMode
    result=$?
    if [ $result -eq 125 ]; then
      poweroff
    fi
    if [ $result -eq 122 ]; then
      reboot
    fi
    sleep 3s
    # Any exit code that does not specify a specific behavior, just causes the loop to restart the app.
done

The net result of this is that no GUI desktop is started up. Because of that, we cannot enter non-English characters in dialogs in our application.

I can run the system in normal desktop mode and use the Text Entry configuration to configure toggling through various languages. I can then enter character for German, Hebrew, Russian etc. based on the keyboard mapping that is enabled via the special keystroke (default is 'Super-space'). However when running in kiosk mode, I just get the English characters.

My inference is that the key mapping is performed by some component that is started/installed by the normal desktop session startup (gnome-session seems to be the thing that does that).

How can I start that same component in my script?

EDIT: To clarify, the question is not how to get multiple keymaps enabled. I can use desktop mode to do that if needed. The question is how to actually switch between them once in kiosk mode. The special keystroke configured in the Text Entry settings item, has no effect in kiosk mode.

1 Answers1

1

You can set multiple layouts in the /etc/default/keyboard file. For instance, if you open that file for editing and set

XKBLAYOUT="us,de,ru"

you should be able to switch between English (US), German and Russian without a need to first add those layouts via Text Entry.

Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94
  • Thanks for the suggestion but that did not help. I still cannot change between the layouts in kiosk mode. – Steve Fallows Aug 02 '16 at 13:25
  • @SteveFallows: I can mention that it works in a guest session. But in your case you may need a script. An example: http://askubuntu.com/a/795662 – Gunnar Hjalmarsson Aug 02 '16 at 13:47
  • I experimented heavily with the gsettings commands in that post. Changing the current index into the array of language mappings workd in desktop mode, but in kiosk mode all typed characters remain English. – Steve Fallows Aug 03 '16 at 20:31
  • @SteveFallows: I see. Have to admit that your kiosk mode setup is above my head. Sorry if it was a dead end. – Gunnar Hjalmarsson Aug 03 '16 at 21:08