Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 0 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:

allow-user-xsession

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:

http://unix.stackexchange.com/questions/11604/run-xmodmap-commands-after-login http://unix.stackexchange.com/questions/1677/why-wont-my-xmodmap-command-run-on-startup-login

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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