How to set your Compose Key on XFCE/Xubuntu & LXDE Linux

Blueprint style diagram showing the compose key sequence for the Euro currency symbol.

Just hold down your chosen compose key, then press the other keys in turn: [compose key] + e + = gets you a Euro symbol.

The compose key on Linux is incredibly useful, but not configured by default - and on XFCE there’s currently no graphical UI to change it. However, it’s pretty simple to change… here’s how to make the Caps Lock key your compose key:

In the file /etc/default/keyboard, change XKBOPTIONS to look like this:

XKBOPTIONS="compose:caps"

Save the file. You can now either reboot, restart X, or see Activating your change without rebooting, below.

If you don’t want to use Caps Lock as your compose key, there are some other options to choose from in this file: /usr/share/X11/xkb/rules/xorg.lst - search for ‘compose’, they’re listed towards the end. Mine currently looks like this:

Setting Compose Key
compose:ralt Right Alt
compose:lwin Left Win
compose:rwin Right Win
compose:menu Menu
compose:lctrl Left Ctrl
compose:rctrl Right Ctrl
compose:caps Caps Lock
compose:102 <Less/Greater>
compose:paus Pause
compose:prsc PrtSc
compose:sclk Scroll Lock

Using the Compose Key

Try holding down the Caps Lock key and type the letter l, followed by a dash you should get a British Pound symbol: £ - magic!

Generally you can just hold down your compose key then type a combo that kinda ‘looks like’ the symbol you want, if they were drawn on top of each other. For example, e followed by = will get you a Euro symbol: €, o followed by c will get you a copyright symbol: © - and 1 followed by 2 gets you a half fraction: ½.

These work anywhere you can type things. There’s a list of some common ones here, and a full list here.

Activating your change without rebooting

Option One

Once you’ve changed your permanent setup by changing /etc/default/keyboard, you can set your current session using setxkbmap, like this:

$ setxkbmap -option compose:caps

It uses the same names for keys as above. It’s also possible to leave /etc/default/keyboard alone and add this command to your ~/.xinit, ~/.xsession or the XFCE autostart commands instead. If you do that, it’ll only apply to your login, not system wide though.

Option Two

This was the first method that I discovered and isn’t a simple as Option One, but if that doesn’t work for some reason, this should. Like it says at the top of /etc/default/keyboard, check /usr/share/doc/keyboard-configuration/README.Debian for what to do after you’ve modified it. Mine currently says:

After modifying /etc/default/keyboard, you can apply the changes to the Linux console by running setupcon. If X is configured to use that file too, then the changes will become visible to X only if

udevadm trigger --subsystem-match=input --action=change

is called, or the system is rebooted.

When it says Console, it means it — not a terminal window, an actual login console — try pressing Ctrl + Alt + F1 and logging in, then running:

$ setupcon
$ udevadm trigger --subsystem-match=input --action=change

These don’t print anything out when they run, disconcertingly. Once you’ve run them in the Console, Ctrl + Alt + F7 should get you back to the default console session you were in before.


Related Posts


Comments