Adding custom Compose key sequences

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.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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.

Method 2

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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x