12

My preferred keyboard configuration is US-International. When I use it on MS-Windows and type certain special characters (i.e., ~ ' ") followed by a, o n I get á ó or ñ as I wish.

However when I type these characters followed by a letter that doesn't match, I will get that special character followed by the letter. So if I want to type, let's say, "q I can do it by pressing "q. However, if I do the same on Gnome I need to do it like "q, otherwise I get an audible bell.

Also, if I want to type two single quotes, in Gnome I need to type ' four times, instead of the two times it takes on MS-windows. I know it is a rather minor annoyance, but it does get to me, and I see GNU+Linux as a highly customizable OS, and I'd like to learn more about how do I do such things. Changing to the normal US keyboard is not an option, because I need to use characters such as á ó or ñ for typing in Spanish.


note: I am using Debian

Anthon
  • 79,293
  • Well, changing to normal US + compose key is an option, then you'd type compose, ', a for á, compose ', o for ó, compose, ~, n for ñ, etc. But that's more a workaround than a answer to your question of how you modify a keyboard loyout. – derobert Aug 13 '14 at 03:34
  • I have the same issue here on KDE. The proposed solutions are all insufficient as they involve more keypresses than I'd like. – rubenvb Sep 30 '14 at 07:13
  • 1
    I think, I recently posed the same question just for Linux Mint instead of Debian. See here for my (almost complete) solution using xim: http://unix.stackexchange.com/questions/220510/insert-both-characters-if-a-dead-key-combination-is-not-recognized-e-g-a-%E2%86%92-%C3%A1/223700#223700 – Jamie Holsten Aug 17 '15 at 13:31

2 Answers2

12

The dead key sequences are configured in the same place as the compose key sequences, in the compose map. The compose map file is loaded by each application when it starts up; the following files are tried in order:

  1. the file name indicated by the environment variable XCOMPOSEFILE
  2. ~/.XCompose
  3. /usr/share/X11/locale/LOCALE_NAME/Compose (e.g. /usr/share/X11/locale/en_US.UTF-8/Compose)

There's no include mechanism, so if you want to modify the table, you'll need to make a copy of the standard file and edit it.

For example, to define dead ¨ q to insert "q and dead ' dead ' to insert '':

<dead_diaeresis> <q> : "\"q"
<dead_acute> <dead_acute> : "''"

You'll have to repeat the "q sequence for all letters, there's no macro facility. As far as I know, there's no fallback facility either: if a sequence is defined for <dead_diaeresis> <a> but none for <dead_diaeresis> <q> then typing <dead_diaeresis> <q> will not insert anything.

If you want more sophisticated capabilities, you'll have to move on from the basic compose facility into the world of input methods. Input methods are primarily intended for people who use non-alphabetic scripts or multiple scripts, but of course you can use it for diacritics as well. Several input method frameworks are available. Since Gnome 3.6, Gnome integrates support for iBus.

2

There are a few US International keyboard layout options, five or so I believe.

You seem to have chosen one with dead keys enabled, try another one. There are some that use Alt Gr combinations e.g. alt gr"o for ö.

There is also the option to use the compose key.

compose"o for ö (this is what I use), of Alt non-combining then alt gro may produce ö or ó or . Experiment with the various settings for keyboard layout.

Another option is to have two layouts, Spanish and US English. You can set a key for switching, and display the current layout in the tray.

Peregrino69
  • 2,417