Unused Cycles

April 22, 2009

Using the Context Menu Key as a Compose Key

Filed under: GNU/Linux — Kevin @ 9:10 am

I’ve noticed over the last few months that I don’t use the “context menu” key very much. Actually, I never use it, and I find it really annoying when I’m scrolling through a webpage with my arrow keys and accidentally bump it. On top of that, I wanted an easy way to type letters with accents, so I could do things like type über or a ¢ sign without having to go to a character map.

If you’re new to Linux, what I was looking for is called a “compose key.” The compose key works like this: tap the compose key, then a modifier, and lastly the letter you want. For example, if I want an e with a grave accent, I type “compose, ` (the character next to 1), e” in that order, and voilà I get a nice è.

Now, how do you go about setting your context menu key to act as a compose key? In Linux, it’s as easy as typing

setxkbmap -option "compose:menu"

into a terminal. You’ll immediately have a compose key. Even things such as £ (compose, -, L) or € (compose, =, C) will work on a US keyboard now! A complete listing of compose key combinations is here. The only problem is, when you restart X, your settings will go away so you’ll have to run that every time you start X. You can do that one of two ways:

  1. In /etc/X11/xorg.conf, add Option "XkbOptions" "compose:menu" to your keyboard section.
  2. Add the previoius “setxkbmap” line to a startup script. For example, I’m running KDE 4.2, so I added that line to ~/.kde4/Autostart/startup.sh (chmodded so that it’s executable, of course) so that KDE will run that command every time I log in. In GNOME, it should be as easy as going to System>Preferences>Sessions.

I recommend using the second method, because it will only change the setting for your user. Who knows, perhaps other people do use the context menu key.


Leave a Comment »

No comments yet.

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

Blog at WordPress.com.

%d bloggers like this: