How To Enable Non-ASCII Characters On Linux

Linux: If you want to easily type non-ASCII characters that likely aren't already on your keyboard (e.g. ™, µ, ½) and don't want to constantly refer to character selector apps such as kcharselect, you can turn on the Compose Key in Linux.

Image via Wikipedia.

Most keyboards won't have this key, but you can still use it by rebinding an infrequently-used key (such as the context menu key) to act as Compose.

How to Enable the Compose Key

In GNOME: Click System > Preferences > Keyboard. If there is a "Layout Options" tab, you can configure it there by ticking a checkbox for the key you'd like to replace. If a "Layout Options" is not visible, check the "Layouts" tab for a button that titled "Other Options…" that will have the same list of checkboxes.

In KDE: Open the System Settings panel from either the GUI or by running the systemsettings command. Under the section "Regional & language" choose "Keyboard Layout" and choose to enable keyboard layouts. Now, under the "Advanced" tab, you can set the compose key by ticking the checkbox of the key(s) you want to replace with Compose.

Alternative Method: The previous two examples will work for most users, but a few people may be using environments that don't give easy access to keyboard layout configuration. If that's the case, it's still possible to set the key with setxkbmap by adding setxkbmap -option compose:menu to a startup script such as xinitrc.

The best place to put the command will vary by distribution and configuration, but the few people that need this method probably already know enough to figure it out.

How to Use the Compose Key

Compose Key sequences are performed by tapping the compose key and then a sequence of two characters to create a special character. For example: compose 1 2 gives you a ½ symbol.

A good list of characters can be found here.

If you decide you want to add new compose sequences, you can copy /usr/share/X11/locale/en_US.UTF-8/Compose (replace en_US.UTF-8 with your locale) to ~/.XCompose and then edit it to your liking.


Be the first to comment on this story!