2

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.

  • This question is relevant for 13.10 too. Tag added. – Rmano Mar 22 '14 at 4:25
  • I must have a truly messed up system. I tried modifying the keycodes directly in /usr/share/X11/xkb/keycodes/evdev (as suggested here: unix.stackexchange.com/questions/9635/… and nothing changed. I have no idea where the keycodes are coming from. This is an amazing amount of sleuthing for such a simple feature. – user1007671 Mar 22 '14 at 7:09
  • Reading here: ubuntuforums.org/showthread.php?t=1589744 I discovered that to force recompilation you need to remove the compiled files from /usr/share/X11/xkb. This has produced a workable workaround for now. I think the 'real' solution might involve creating appropriate rules and symbols which can then be loaded via ~/.Xkbmap. But it's a mystery to me if those new rules and symbols could reside somewhere other than in /usr/share/X11/xkb/. I'm also not adept enough to write the new rules and symbols required for even to switch the LCTL and LALT keys - which was my goal. – user1007671 Mar 22 '14 at 7:44
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\! " &
  • Thanks for the zenity suggestion! It looks like .xprofile is getting run, but xkb mappings are happening after it is run. This behavior is consistent with the information in the answer to this post: askubuntu.com/questions/150487/… That seems to suggest I should be creating a properly formatted file to put in ~/.Xkbmap. I'm trying to figure out how to get there from here! – user1007671 Mar 22 '14 at 4:51
  • @user1007671 --- ok, thanks for the heads up. When you are successfully --- please post a question/answer pair for how to install a personal keymap (maybe here, but explain too how you built your .xkb file). I have found links here: askubuntu.com/a/423245/16395 but still I could not find an easy howto. – Rmano Mar 22 '14 at 5:19
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).

  • could you please provide the details about swapping Alt and Ctl keys? The blog with instructions is no longer available. – Alex Fedulov Sep 20 '15 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.