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've just switched from LXDE to Gnome and I'm struggling with configuring the keyboard the way I want it. The Swedish keyboard layout is painful when programming (e.g. {[]} require right-hand finger acrobatics) so I've remapped them using xkbcomp.

Under LXDE/LXDM I could have the mapping happen automatically on login by putting it in ~/.xprofile. This doesn't work under Gnome/GDM though. /etc/gdm/Xsession, which GDM uses to launch gnome-session, does source ~/.xprofile, but by the time I'm logged in and starting a terminal the mappings have been undone. I'm guessing something that gnome-session or one of its cohorts undoes my careful changes to the keyboard map.

I suppose I need to somehow make my changes at a later stage in the login process, but I've not managed to find a way to achieve that. How can I do that?

(Alternatively, is there a way to add user keyboard layouts that get picked up by the Gnome3 keyboard layout settings dialogue? Or failing that, how can I add layouts in the system?)

share|improve this question
    
Have you tried using .bashrc or .profile? –  terdon Jan 4 '13 at 10:20
    
I have tried running /etc/gdm/Xsession in a login shell with no luck. Just adding it to either of those files will require that I start a terminal before the mappings are active, which isn't ideal since I do quite a bit of my development in Eclipse. –  Magnus Jan 4 '13 at 10:28
    
Adding it to ~/.profile should cause it to be run on login, adding it to ~/.bashrc will require a terminal since it is only read for non-login shells. See here. –  terdon Jan 4 '13 at 11:53
    
The big question is when during login. When looking more closely at my system's /etc/gdm/Xsession it sources both ~/.profile and ~/.xprofile (in that order), so moving stuff from ~/.xprofile to ~/.profile is pointless. Unless of course, gnome-session itself sources ~/.profile but not ~/.xprofile, which it doesn't according to my tests just now. –  Magnus Jan 4 '13 at 14:02
    
Hmm... OK, how about the ugly hack of making eclipse an alias to something like source ~/.xprofile && ecplipse? –  terdon Jan 4 '13 at 14:23

1 Answer 1

Silly me! After a bit of thinking I found a good and easy way of doing it:

  1. Copy the contents of ~/.xprofile into a script somewhere. Make sure it's executable.
  2. Start gnome-session-properties and add a new startup program. Point it to the script.

That's it.

Much easier than fiddling around with special dot-files that are sourced on login, really :)

share|improve this answer

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.