Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I add a custom compose key sequence?

For example, I would like Compose, |, > to type the symbol.

I have tried adding the following to ~/.XCompose:

# Import default rules from the system Compose file
include "%L"

# Custom definitions
<Multi_key> <bar> <greater> : "▸" U25B8 # Black right-pointing small triangle

but the new sequence is not usable anywhere except for xterm.

Installing ibus-table-compose and then enabling the Compose input method in IBus did not solve the problem; IBus imitated many compose key sequences, but not the one I had created.

share|improve this question
    
How do you type the symbol now? You could probably map the command you use to type the symbol to specific keys in keyboard layout. To find the exact keysym of a particular key, you can use xev . But ofcourse, this is just my guess. –  nitstorm Jun 7 '11 at 15:52
2  
@nitstorm I typed it by pressing AltGr+>, which is a customized mapping that I set by adding the keysym U25B8 to keycode 60 in ~/.xmodmaprc. I'm not asking how to type ▸; I'm asking how to create a compose key sequence for it. –  ændrük Jun 7 '11 at 16:05

2 Answers 2

up vote 9 down vote accepted

Do this first:

Create a file ~/.XCompose (that is a file named .XCompose in your "home" folder) which contains the following:

include "%L"   # import the default Compose file for your locale
<Multi_key> <bar> <greater>     : "▸"

See man 5 Compose for more info about the format of this file.

Then add export GTK_IM_MODULE="xim" to your .profile file and restart X.

share|improve this answer
1  
I noticed that with this solution, I cannot use Ctrl-Shift-u anymore to insert unicode characters by number; so I take it that this switches something general away from the Gnome stuff to the X stuff which is configured by that ~/.XCompose file. Is there also a way to modify the Gnome stuff instead? I'd like to keep that Ctrl-Shift-u feature. –  Alfe Jan 28 '13 at 15:31
1  
@Alfe Using UIM as suggested on the bottom of Ubuntu Forums: .XCompose file not read in 11.04 GNOME works for me with the default settings in Debian jessie/sid (see im-config(8) for customization). That is, .XCompose settings are working both in GTK (GNOME) and Qt (KDE) applications, and .XCompose and Ctrl+Shift+U are both working in GTK applications (like Eclipse). –  PointedEars May 10 '13 at 16:22
    
Thank you! So did you just apt-get the uim package or did you have to configure something else? –  Alfe May 10 '13 at 19:59
1  
I tried to get this running for some time now, but to no avail. It'd be very helpful to hear what exactly you did besides installing the uim package. At least this could help to be sure that your way doesn't work on Ubuntu 12.04. –  Alfe May 10 '13 at 22:32
    
@dan_waterford Hi, I just asked this question here, and had it "possible duplicate"'d to this question. However, I've tried your answer and couldn't get it to work. Any ideas? :) –  Owen_R Nov 15 '13 at 17:42

Create a file ~/.XCompose (that is a file named .XCompose in your "home" folder) which contains the following:

include "%L"   # import the default Compose file for your locale
<Multi_key> <bar> <greater>     : "▸"

See man 5 Compose for more info about the format of this file.

share|improve this answer
    
Neat! Is there any way to have this file re-read without restarting X? –  Jeremy Kerr Jun 8 '11 at 7:10
    
This sounds promising, but my ~/.XCompose file doesn't seem to have any effect even after rebooting. Have you gotten this to work? –  ændrük Jun 8 '11 at 15:49
    
@Jeremy: I'm not sure, but maybe changing the keyboard layout to another layout and then back might work. –  JanC Jun 9 '11 at 12:52
1  
@ændrük: I seem to remember that Gtk/GNOME stupidly messes with the compose key settings (you can test if the new Compose key combination works in e.g. xterm to confirm this is the case). I seem to remember the workaround had something to do with selecting an alternative input method that bypasses the problematic medling; maybe ask a new question about that, because it's not only useful for this but IIRC it also fixes locale-specific Compose maps, etc. ;) –  JanC Jun 9 '11 at 13:14
    
Actually, this question is probably relevant. –  JanC Jun 9 '11 at 13:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.