LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Blogs > MTK358
User Name
Password

Notices


Rate this Entry

How to enable the Compose key in X

Posted 06-12-2010 at 11:33 AM by MTK358
Updated 04-19-2011 at 08:23 AM by MTK358

Here I will show you how to enable the Compose key in X. It lets you type unusual characters like this:

Çøµþö§ə kæÿ

by pressing the Compose key followed by a predefined sequence of keys. Here are some good references:

http://en.wikipedia.org/wiki/Compose_key
http://www.hermit.org/Linux/ComposeKeys.html

Anyway, first you need to choose which key you want to be the Compose key. Then, open a terminal and enter the command "xev" (without the quotes). A window called "Event Tester" will pop up. Make sure that it's focused by clicking on it and leaving the mouse cursor in it.

Now press and release the key that you want to become the Compose key. Remember or write down the number after the word "keycode" in the output (see below image):



Now open the file ".Xmodmap" (the name begins with a dot) in your home directory (create it if it isn't there already) with a text editor and type in the following line, replacing <keycode number> with the number you got in xev.

Code:
keycode <keycode number> = Multi_key
Now, open the file .xinitrc (it's in your home directory, and it's a hidden file) in a text editor. Insert this line in the beginning of the file:

Code:
xmodmap ~/.Xmodmap
And next time you log in the Compose key should work! To start using the Compose key right now, enter the command "xmodmap ~/.Xmodmap" in a terminal.

Here's some more information abotu the Compose key, including what characters you can type and how:

http://en.wikipedia.org/wiki/Compose_key
http://www.hermit.org/Linux/ComposeKeys.html

IMPORTANT: I can't guarantee that this will work for systems that use a GUI login manager, I don't know how those work. I can only guarantee that this will work with the "startx" command.
Posted in Uncategorized
Views 19837 Comments 3
« Prev     Main     Next »
Total Comments 3

Comments

  1. Old Comment
    Thanks MTK358.

    I used this in XFCE and it worked like a charm. Very useful post.
    Posted 04-30-2011 at 05:42 PM by lupusarcanus lupusarcanus is offline
  2. Old Comment
    I use a variation on this (I just set the key mapping directly with 'xmodmap -e "keycode 108 = Multi_key"'; no .Xmodmap file) with SLiM and Xfce and it works pərfectly.

    SLiM does use .xinitrc, though, so I'm not sure if this would work with gdm, kdm, xdm, etc., either.
    Posted 07-04-2011 at 09:04 AM by MrCode MrCode is offline
  3. Old Comment
    Thanks a lot MTK358. This information was a real time-saver!
    Posted 08-12-2011 at 04:19 PM by Diantre Diantre is offline
 

  



All times are GMT -5. The time now is 06:04 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration