17

I've been wondering if there's any add on available that does something like Mac OS X. My mother tongue is Spanish, and now I live in a Francophone environment, I also do English a lot, so I'm in need of different accents, specially in French, I have been using Linux for two years now and have also been using Mac OS X every now and then, for testing purposes.

I find really useful the functionality available on Mac OS X, where you keep pressing the key and it displays a list of available options on the same character, different accents, or punctuation. Can I do this on Linux?

For instance:

enter image description here

  • 1
    That would be rad. Can you please post a screenshot of this functionality? I think it would be useful to illustrate how awesome this is... – Jonathan Komar Nov 15 '16 at 18:29
3

I am afraid I know of no application that does this. Developing one would probably require creating your own input method (to replace XIM).

However, I can offer you an alternative that you may find far more helpful than simply changing the key layout. X (through XIM), for some time now, has offered a utility called XCompose. XCompose allows you to type “exotic” characters by hitting a leading key (which you designate) followed by customizable key sequences. For example, Composee' yields the character é. The default sequences, for the most part, are quite intuitive, but the most powerful part of XCompose is that you can add (or modify) sequences in order to, theoretically, generate any unicode character you see fit.

The setup of sequences is done through plain text files (that you either put in $HOME/.XCompose or that you put elsewhere but have $HOME/.XCompose source (You can look at my whole setup here if you are interested; look specifically at XCompose and the files under compose/). Below is a snippet of my personal $HOME/.XCompose:

include "%L"     # This enables all the default bindings
include "/home/halosghost/.compose/greek.compose" # some greek characters

And now a snippet of the greek.compose included above (beware that these are certainly not the most ergonomic or efficient sequences you could use, they are just an example):

# Lower case
<Multi_key> <a> <l> <p> <h> <a>     : "α"   U03B1   # Alpha
<Multi_key> <b> <e> <t> <a>         : "β"   U03B2   # Beta
<Multi_key> <d> <e> <l> <t> <a>     : "δ"   U03B4   # Delta
<Multi_key> <g> <a> <m> <m> <a>     : "γ"   U03B3   # Gamma
<Multi_key> <l> <a> <m> <b> <d> <a> : "λ"   U03BB   # Lambda
<Multi_key> <p> <i>                 : "π"   U03C0   # Pi
<Multi_key> <m> <u>                 : "µ"   U03BC   # Mu

You an see that the format of these files is actually very simple (though there are a few cases where you do not use the character itself but rather a name for it (e.g., <period> rather than <.>)).

With the above, I can now type Capsmu to generate µ (note that my Compose key is set to Caps).

You did not mention which distro you are using (or looking into using), but XCompose ships with xorg so all you should need to do is set it up. The related reading for setting Compose up with XIM can be found here, but you should also note the XIM is getting pretty old these days and it may not be the best option. Also, there is at least one other IME that supports Compose sequences (though it uses a slightly different implementation): IBus.

Personally, I use XIM, and I hope to do so until I switch to wayland (where I hope there will be an all-around better IME waiting for me²), but this is Linux; one size doesn't fit all, and you should use what works best for your workflow (within reason).


  1. From that link, you will find that you can easily set which key you use for Compose (assuming your keyboard is not esoteric enough to actually have a dedicated Compose key) through the following command (for Caps):

    setxkbmap -option compose:caps
    
  2. I can dream, right?

As a fun final note, all “exotic” characters in this post (including é, “, ”, µ, ¹ and ²) were generated using XCompose.

  • Which, would you say, would be the differences between XIM and using the compose key?, Please, do not get me wrong but seems like setting up a custom key sequence mapper instead of using the one already exists a bit of an overhead, The obvious to me is to have Custom Keys, but I believe you can achieve that as well using the Compose Key, I am using a Linux Mint on a Debian Base as Distro. I would probably end up setting up something as you suggest, however it would be pedagogic for me to learn the differences., Thanks for answering. – ximbal Apr 22 '15 at 16:59
  • I think you're a little confused about the setup (which may very well be my fault). XIM is an IME that offers the Compose key. The custom sequences I mentioned and demonstrated aren't separate from the Compose key, they are extensions that I have personally added. So, with the first include line I showed from that .XCompose snippet, you get all of the default Compose sequences, and then I add more as I see fit (sometimes overriding some defaults). – HalosGhost Apr 22 '15 at 17:08
  • 1
    I'll give it a try, I'll get back to you, thanks for the help – ximbal Apr 22 '15 at 18:15
0

You might want to enable your Compose Key. This allows you to compose characters using symbols that "look like" parts of the composite. I use Alt Gr as my Compose key, but usually it's possible to select any suitably unused key.

For example, Compose o / will give ø, Compose a ` will give à, and so on.

This is very different to using Dead Keys, where accent characters do not appear as standalone characters unless hit twice in succession; this is usually extremely frustrating to programmers.

Compose Key functionality has been around for a long time (I believe it appeared on "real" Sun terminals). It is built-in to most (many? all?) GUIs on Linux-based systems. I know of and also use corresponding software for Windows.

  • 1
    I know of the use of Compose Key, however, I do not find it as obvious to remember 15 different key sequences for all the possible characters, I know it is a solution that works, and that has been there for a long time, but I've tried it and I end up forgetting the key sequences, lots of other stuff to focus on. Thanks for trying to answer. – ximbal Apr 22 '15 at 16:56
  • 1
    Compose, as mentioned in my post, is a feature of XIM (the X Input Module) IME. A few other IMEs offer similar functionality (like IBus), but any GUI which uses XIM for input (you can set both GTK and Qt to use XIM) will support Compose if you have it setup. – HalosGhost Apr 22 '15 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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