Keeping it Small and Simple

2007.12.26

Using multiple keymaps in X

Filed under: X Windows — Tags: , , , , , — Lorenzo E. Danielsson @ 02:12

The other day I blogged about my frustration over Opera not recognizing when I changed keymaps with setxkbmap. Well, it turned out that not only Opera had a problem, but all Qt and Gtk2 applications. (I guess that tells a bit about me that I haven’t realized this until now).

My ~/.fluxbox/keys file contained the follwing lines, which worked well in the applications that I happen to use most of the time (rxvt-unicode, vim):

Mod4 G :Exec setxkbmap -layout gh -variant ga
Mod4 S :Exec setxkbmap -layout se -variant nodeadkeys
Mod4 U :Exec setxkbmap -layout us

I noticed one thing. If I changed the keymap before launching Opera, the browser would use that keymap. So if, at the time of starting Opera, I was using a Swedish keymap, then I would be able to enter Swedish keys in Opera. But changing the keymap while Opera was running had no effect.

The fix for the problem was simple, after a bit of Googling. I modified ~/.xinitrc to look as follows:

setxkbmap -option grp:switch,grp:shift_toggle,grp_led:scroll us,se,gh -variant ',,ga'
exec startfluxbox

Now the few Qt and Gtk applications that I use behave well! I can switch between US, Swedish and Ga keyboards in all X applications.

Moral: if somethings doesn’t work as you like, don’t get frustrated, get searching. Somebody has had the problem before, fixed it and documented it.

Advertisements

2 Comments »

  1. “Moral: if somethings doesn’t work as you like, don’t get frustrated, get searching. Somebody has had the problem before, fixed it and documented it.”

    Indeed, and thanks for sharing. 😉

    Comment by Tiddledoo — 2008.03.16 @ 00:25

  2. I’m glad that it helped you.

    One of the main reasons why I try to blog about it every time I solve a problem is because of the enormous amount of help I’ve had from reading how others have solved problems that I’ve had. I think the best way I can do something in return is to contribute to the “pool of solutions”. 🙂

    Comment by Lorenzo E. Danielsson — 2008.03.16 @ 00:33


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: