18

How can one add custom Compose-key sequences? I have googled quite a bit, but could not find an explanation. In particular, I would like to have:

<Compose> + <Z> + <Z> = ℤ # Blackboard bold Z (set of integers)

In particular, I tried copying the file /usr/share/X11/locale/en_US.UTF-8/Compose to ~/.XCompose, and mimicked its syntax. However, this did not seem to work.

3
  • What did you do after creating ~/.XCompose to activate it?
    – l0b0
    Commented Dec 4, 2013 at 13:07
  • well, nothing particular. The site I got this from didn't mention anything. What is one supposed to do?
    – jmc
    Commented Dec 4, 2013 at 13:13
  • 2
    I run ibus restart to reload the ~/.XCompose file on Ubuntu to see the changes. This activates it if the change was "created the file". 🙂
    – DDR
    Commented Aug 13, 2022 at 21:45

2 Answers 2

20

You're almost there: the file is indeed ~/.XCompose. You can specify an alternate location with the XCOMPOSEFILE environment variable. See the Compose manual page.

The missing piece of the puzzle is that the file is read by each application when it starts. The Compose key is not handled by the X11 server, but by the X11 library. In theory, an application could detect that the file has been modified or offer a command to reload it but I don't know of any that does. You'll have to restart your applications. Start a new editor or terminal emulator for testing.

3
  • Thanks for your answer! I feel really stupid for not checking whether there was a compose manpage. However, Google did not turn it up either…
    – jmc
    Commented Dec 5, 2013 at 13:09
  • 2
    On Debian you can also have a look at the official wiki. Commented Mar 30, 2020 at 10:42
  • As the wiki states: "... make sure ~/.XCompose has include "%L" at the top of it, to bring in the default sequences."
    – ergohack
    Commented Nov 9, 2023 at 19:29
-1

See @Gilles' answer.

Original answer:


You may need to log out and in again, since your personal configuration files are read when logging in.

(There may also be some way to activate it without logging out and in again, but I'm not familiar with this specific configuration file.)

3
  • 4
    No, you don't need to log out, only to restart the applications. The compose table is read by each application. For KDE, you may need to restart kdeinit, I haven't checked. Commented Dec 5, 2013 at 13:21
  • 1
    This is not an answer, at least without the actual actions required before logging out and in again.
    – naught101
    Commented Dec 24, 2013 at 5:09
  • @naught101 The user has already performed those. The question was how to activate the new settings.
    – l0b0
    Commented Dec 24, 2013 at 10:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .