1

I'm running Debian 20.0.4 under XFCE4. I want to set up the left "Win" key (i.e., LWIN) on my keyboard as a dead key which can be used to output vowels with acute accents and which can be used to output the letter "n" with a tilde. For example:

LWIN + a => á
LWIN + n => ñ
... etc. ...

Based on internet searches and a few conversations I've had with others, I ended up trying a combination of setxkbmap and ~/.XCompose settings, as follows:

/usr/bin/setxkbmap -option compose:lwin

And in ~/.XCompose ...

include "%L"

<Multi_key> <a> : "á"
<Multi_key> <A> : "Á"
<Multi_key> <e> : "é"
<Multi_key> <E> : "É"
<Multi_key> <i> : "í"
<Multi_key> <I> : "Í"
<Multi_key> <o> : "ó"
<Multi_key> <O> : "Ó"
<Multi_key> <u> : "ú"
<Multi_key> <U> : "Ú"
<Multi_key> <n> : "ñ"
<Multi_key> <N> : "Ñ"

However, all that seems to be happening is that I have to perform the following 3-keystroke combinations to get the results I want (for example) ...

LWIN + ' + a => á
LWIN + ~ + n => ñ
... etc. ...

It seems like either the ~/.XCompose settings are being ignored and only xsetxkbmap is being honored, or perhaps there is something that is just simply incorrect about what I'm doing ... ???

I don't want to type any 3-keystroke sequence to get these special characters (and it's actually 4 keystrokes for the tilde over the "n", because I also need to press the Shift key to enter the tilde).

I'm looking for a 2-keystroke method to enter each and every one of these special characters.

Also, I do not want to set up the apostrophe ( ' ) as a dead key, because then I would need to specify a two-keystroke combination in order to enter a normal apostrophe, and I don't want to do that. That's why I would like a key that I normally don't use (such as LWIN) to be a dead key that I can use for the 2-keystroke combinations.

Is there any way that I can accomplish this?

Thank you in advance for any thoughts and suggestions.

UPDATE: I tried this with /usr/bin/xmodmap -e "keysym Super_L = Multi_key" instead of the setxkbmap command, and it doesn't work any better.

And I also tried the same things with the CapsLock key instead of LWIN, and these CapsLock versions don't work, either.

FURTHER UPDATE: For anyone who doesn't know what I mean by "dead key", the following explains what that term means: https://en.wikipedia.org/wiki/Dead_key .

1 Answer 1

1

I figured it out! First of all, it's necessary to read and understand all of the following Superuser article: Setting Hyper and Super modifiers for certain keys with setxkbmap or xmodmap

I want to be able to type Spanish characters, and so I want to be able to put acute accents on "a", "e", "i", "o", and "u", to put a tilde on "n", to allow "u" to have an umlaut (for words like vergüenza), and to be able to use the upside-down "!" and "?".

And in addition to Left-Win, I decided to also set Right-Win, CapsLock, and the Menu key all to serve as Mode_switch keys (i.e., all four of them should work like the Shift key or the Ctrl key; they are held down while typing another character which then gets modified).

Here's how I accomplished this ...

It turns out that I don't need setxkbmap nor ~/.XCompose at all.

On my XFCE4 system, the file ~/.Xmodmap is automatically read and processed when X starts up, so everything in that article which refers to ~/.xmodmap needed to be done instead in ~/.Xmodmap on my system.

Following the logic in that article, I created a default ~/.Xmodmap via /usr/bin/xmodmap -pke >~/.Xmodmap followed by making a backup of that file to ~/.Xmodmap.backup.

I then used /usr/bin/xev to get the keycodes for all of the characters that I want to process, and I changed the following key definitions in ~/.Xmodmap ...

keycode  66 = Mode_switch
keycode 133 = Mode_switch
keycode 134 = Mode_switch
keycode 135 = Mode_switch

keycode  38 = a A aacute Aacute aacute Aacute aacute Aacute aacute Aacute
keycode  26 = e E eacute Eacute eacute Eacute eacute Eacute eacute Eacute
keycode  31 = i I iacute Iacute iacute Iacute iacute Iacute iacute Iacute
keycode  32 = o O oacute Oacute oacute Oacute oacute Oacute oacute Oacute
keycode  30 = u U uacute Uacute uacute Uacute uacute Uacute uacute Uacute
keycode  47 = semicolon colon udiaeresis Udiaeresis udiaeresis Udiaeresis udiaeresis Udiaeresis udiaeresis Udiaeresis
keycode  57 = n N ntilde Ntilde ntilde Ntilde ntilde Ntilde ntilde Ntilde
keycode  10 = 1 exclam exclamdown exclamdown exclamdown exclamdown exclamdown exclamdown exclamdown exclamdown
keycode  61 = slash question questiondown questiondown questiondown questiondown questiondown questiondown questiondown questiondown

(Note that I decided to use Mode_switch + ; for u-umlaut, both lower case and upper case).

I kept all the other key definitions in ~/.Xmodmap with their default values.

Then, after running /usr/bin/xmodmap ~/.Xmodmap, I could hold down any of the above-mentioned Mode_switch keys before typing the specified characters, and the character modifications worked properly.

And after rebooting, these key translation mechanisms all remained in effect.

2
  • 1
    Well done - congratulations :)
    – tink
    Commented Aug 21, 2022 at 1:26
  • Thank you very much!
    – HippoMan
    Commented Aug 21, 2022 at 22:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .