3

How do I install my custom keyboard map and have it start automatically at startup?

The following command works when I run it in a terminal:

xkbcomp -I$HOME/.xkb/ $HOME/.xkb/switch-LALT-LCTL.xkb $DISPLAY

but when I put this into .xinitrc (linked from .xsession just in case), the command is not run. What am I missing? I've spent hours / days searching and trying other 'solutions' but none of these work for me.

Thanks in advance for any help or ideas you may have.

2 Answers2

1

I do not think that .xinitrc is executed by the display manager. Have you tried with .xprofile? It is cited here about a different issue: https://wiki.ubuntu.com/X/Config/Resolution

I often use a small zenity command in these kind of files to confirm they are effectively run, like

zenity --warning --text "I am in .xprofile and I RUN\! " &
Rmano
  • 32,167
1

My work around had been to edit the keycodes in /usr/share/X11/xkb/keycodes/evdev and recompile by removing the .xkm files in /var/lib/xkb/ this was not a sound solution as it would break any other keymapings that involved those keycodes. The correct solution:

lightdm-session runs settings found in ~/.xmodmap or ~/.Xkbmap. Normally this would be the way to go and indeed settings put here are run and applied. But currently there is a bug where if you are running Gnome (which is the default in Ubuntu 13.10 - ubuntu desktop). It will override any settings made here.

The solution then becomes to edit the gnome settings that the gnome keyboard plugin is using to override the ones set by lightdm. In particular, to swap LALT and LCTL (for which there is no simple rule already in place), I followed the directions found here: http://www.itniwo.net/blog/v/404398.html

This involves editing (as root) several files in /usr/share/X11/xkb/. The result of this allows for a new option +ctrl(swap_lalt_lctrl) to be added to the keyboard setup using dconf-editor.

A lot of people on the internet were made angry when their xkb and xmodmap configurations suddenly stopped working after upgrading to 13.10. Too bad millions of dollars of time are being wasted diagnosing and working around this :-(. Somebody smart on the gnome side should write something that would honor any existing xkb settings or at least give warning them that they broke them on purpose (silent overrides are hard to find).