Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to load a custom keyboard layout on login, but either it doesn't load or it gets overridden by the default keyboard layout from 'keyboard preferences'. Unfortunately I can't select my layout there, since its not installed the way default keyboard layouts are, but compiled by xkbcomp.

This is the xkbcomp command

xkbcomp -I$HOME/.config/xkb/ $HOME/.config/xkb/thinkpad.xkb $DISPLAY

It works when entered in the terminal. But when put in /etc/rc.local or .xsession (there followed by the command "mate-session") or run as a 'startup application', the layout doesn't load (or maybe is overridden by the default).

How would I go about this? Or is it possible to install a layout compiled by xkbcomp without hacking .lst and .xml files manually?

share|improve this question
up vote 1 down vote accepted

xkbcomp is an X windows application, you can't run it from rc.local because that is run before X is started.

It should work if you add the command in $HOME/.xsession (without the mate-session) as long as you have this line in your /etc/X11/Xsession.options file:


If the layout is still not set, it is likely being overwritten by Mate. In that case, try adding a sleep call to the command so it gets executed after Mate does it's thing:

(sleep 10 && xkbcomp -I$HOME/.config/xkb/ $HOME/.config/xkb/thinkpad.xkb $DISPLAY)

Possibly helpful:

share|improve this answer
/etc/X11/Xsession.options contains allow-user-xsession. I've further modified .xsession according to Ubuntu Wiki and now all warnings from xkbcomp show up in .xsession-errors, but xkbcomp's changes don't seem to apply. – sao Sep 13 '13 at 13:14
@sao well that's a step in the right direction, at least it is running. What are the warnings? Also, you have not mentioned what Desktop Environment you are using. – terdon Sep 13 '13 at 13:32
it's Linux Mint's Mate, which is a fork of Gnome 2. The warnings are about undefined keycode symbols and unused components (pastebin). But they are the very same warnings that show up when xkbcomp is run from the terminal, so it should still work. – sao Sep 13 '13 at 13:57
@sao yes, at least now you know that the command is being executed. The problem seems to be that Mate is overriding it. You could try adding a sleep call to make it run after Mate sets its own keyboard. Something like sleep 10 && xkbcomp -I$HOME/.config/xkb/ .... – terdon Sep 13 '13 at 14:02
I had to put parens around sleep like (sleep 10 && xkbcomp -I$HOME/.config/xkb/ ...) but it worked! Thanks so much! – sao Sep 13 '13 at 14:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .