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.

jmc
  • 458
  • What did you do after creating ~/.XCompose to activate it? – l0b0 Dec 04 '13 at 13:07
  • well, nothing particular. The site I got this from didn't mention anything. What is one supposed to do? – jmc Dec 04 '13 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 Aug 13 '22 at 21:45

2 Answers2

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.

-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.)

l0b0
  • 51,350
  • 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. – Gilles 'SO- stop being evil' Dec 05 '13 at 13:21
  • 1
    This is not an answer, at least without the actual actions required before logging out and in again. – naught101 Dec 24 '13 at 05:09
  • @naught101 The user has already performed those. The question was how to activate the new settings. – l0b0 Dec 24 '13 at 10:49