.xmodmap doesn't work for two layouts

before doing the upgrade to Ubuntu 13.10 I was using two layouts for the Keyboard - GR & DE. I was able to set both in one .xmodmap, means I was able to configure GR and DE. Now, when I create a .xmodmap it contains only the layout I currently use, but I want both layouts to be in. How can I achieve this?


Solution 1:

I have not solved this problem on 14.04, but I know that this bug keyboard-indicator. After the change of layout, xmodmap settings are reset. I made a script that resets the settings after changing the layout. I hope it will be useful to someone realties.

#!/usr/bin/env python

import os, dbus, gobject
from dbus.mainloop.glib import DBusGMainLoop

def event_handler(args):
        if args == "com.canonical.indicator.keyboard":
                os.system("xmodmap ~/.Xmodmap")

dbus.mainloop.glib.DBusGMainLoop(set_as_default = True)

bus = dbus.SessionBus()
bus.add_signal_receiver(event_handler,
                        dbus_interface="com.canonical.Unity.Panel.Service",
                        signal_name="ReSync")

loop = gobject.MainLoop()
loop.run()

Solution 2:

yup this absolutely a bug in 13.10 , I found a solution for this issue "at least for me" , first update your system , install "gnome-tweak-tool" :

sudo apt-get install gnome-tweak-tool

go to "typing" option change "key(s) to change layout" to "alt+shift" then Click on "Alt/Win key behavior" and Select "Control is mapped to Win keys (and the usual ctrl key)."

I hope this will help somebody

Solution 3:

I confirm this and confirm that it happens in xkb tool as well (so no workaround from there). The xmodmap / xkb modifications are being reset in between layout changes (I use FI-US).

There is several bugs relating to issue here and maybe the closest one to it is this:

https://bugs.launchpad.net/ubuntu/+source/indicator-keyboard/+bug/1215826

(I didn't found the workaround configuration option in comment #34)

I removed new keyboard-indicator, but it only resolved issue that it will not reset xmodmap when focusing other windows.

My current knowledge:

Use either keyboard modifications or layouts, but you can't use both as you could expect. Nasty thing is that this might be not be fixed any time soon (launch bug reports are still open).

Somewhat regression related:

I also found one same kind of bug from unity as well (where I have seen same problem as well, but very infrequently), here is related launchBug:

https://bugs.launchpad.net/ubuntu/+source/unity/+bug/1084451

Edit:

gnome-tweak-tool from repos crashes to segfault (known bug in launchBug, but my reputation forbids me to link it here).