How to set up and use compose key in KDE Plasma?

I have been unable to get the compose (multi) key to work in KDE Plasma desktop environment, but I see that others have.
It seems that a compose key is defined, but has no effect in KDE or GTK applications. I would be grateful for “general user” level advice and guidance.

I have found useful information here:
Thread: How to type special characters
Thread: Compose Key
Thread: Compose Key does not work at all
openSUSE Leap 15 Release Notes
KDE User Base Wiki Tutorials/ComposeKey
Archlinux Forum Can’t set compose key
Archlinux Wiki Keyboard_configuration

I am not confident to follow suggestions to amend system files without more information.
Other solutions don’t work for me.

I trust that the following system information may be useful:-
openSUSE Leap 15.2, KDE Plasma, locale LANG=en_AU.UTF-8
settings > keyboard > hardware - set to Generic 104-key PC (keyboard is USB, DASK3MKPROCLI-CO)
settings > keyboard > layout - set to English (US) [Preview shows ‘Multi-key’ in place of ‘Alt Right’]
settings > keyboard > advanced > position of compose key - set to Right Alt
No keyboard hardware info is displayed with inxi or lsusb.

file:///etc/X11/xorg.conf.d/00-keyboard.conf
# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us"
EndSection

Meanwhile KCharSelect works, but is too clunky to use most of the time.

Let us begin by, understanding what the “Compose” key is – <https://en.wikipedia.org/wiki/Compose_key&gt;.

  1. In current
    KDE Plasma, the “Windows” key is not the “Compose” key – it’s the UNIX® “Meta” key with, an overlay to open the KDE Plasma “program starter” – usually the “Application Launcher” – never, ever, attempt to redefine this key – if the default behaviour is broken, use this guide to repair the behaviour – <Plasma/Tips - KDE UserBase Wiki. 1. As Wikipedia explains, the “AltGr
    ” key is often the “Compose” key. – For KDE Plasma, the “AltGr” key is the “Compose” key. 1. To view the default Compose key settings in KDE Plasma, use the “System Settings
    ” → section “Hardware” → “Input Devices (Keyboard, Mouse, Joystick, Touchpad)” → “Keyboard” → “Layouts” tab → select a Layout and, click the “Preview” button.

The keyboard preview will show the default compose key sequences for that keyboard layout, influenced by Locale, Region (on this Planet) and, Language

Thanks. I’m with you this far.

As i said, layout preview shows ‘Multi-key’ (i.e. AltGr) in place of (US) ‘Alt Right’, as it should be. But it seems to have no effect. I have tried both ‘press and release’ and ‘press and hold’ followed by known code keys, in both GTK and KDE apps. I get the unmodified 1st level output of the code keys.

Something is causing interference. I don’t know enough about XOrg or KDE to track it down. Is it the 4 bit UTF-8 encoding? Is it the unusual LANG=en_AU.UTF-8? It’s an old tool, does it work at all, these days?

Depends on whether or not the Australian layout is UK or US based – if UK then <Alt Gr> – if US then <Alt> «to the right of the space bar» …

  • The layout preview should be indicating that, the <Alt> key to the right of the space is “ISO Level3 Shift
    ” … - Using <AltGr> to denote the <Alt> key to the right of the space bar, what happens when, you press <AltGr-A>? Or, <AltGr-S>? Or, <AltGr-Z>?

Are you certain that, it’s 104 key hardware? Is there a key between <Z> and the left hand <Shift> key?

  • With Linux, the right hand Windows key “Super R
    ” tends to be unused. What happens when, you assign the Compose key to the right hand Windows key?

Keyboard has US key format.

The layout preview should be indicating that, the <Alt> key to the right of the space is “ISO Level3 Shift” …
It does not. It is labelled “Multi Key”. The only place the term “ISO” appears is on Left Tab, labelled “ISO Left Tab”.

Using <AltGr> to denote the <Alt> key to the right of the space bar, what happens when, you press <AltGr-A>? Or, <AltGr-S>? Or, <AltGr-Z>?
I get the unmodified 1st level output of the code keys, i.e. a, s, z.

Are you certain that, it’s 104 key hardware? Is there a key between <Z> and the left hand <Shift> key?
No. Shift key is wider than ordinary keys and located directly to the left of <Z>.

With Linux, the right hand Windows key “Super R” tends to be unused. What happens when, you assign the Compose key to the right hand Windows key?
The “right mouse click” menu pops up and obscures text. Then I get the unmodified 1st level output of the code keys.

Unfortunately, I have a German Cherry CyMotion Master Linux keyboard (105 keys) – therefore this will probably not so helpful –

  • On my keyboard <AltGr+A> <AltGr+S> <AltGr+Z> produce “æ ſ ←” – <AltGr+Y> (which is where “Z” is on your keyboard) produces “»” …

All these characters are those shown by the KDE Plasma Keyboard Preview. But, please be aware that, my settings are specific to my locale and KDE Plasma Regional Settings –


 > localectl
   System Locale: LANG=de_DE.UTF-8
       VC Keymap: de-latin1-nodeadkeys
      X11 Layout: de
       X11 Model: cymotionlinux
     X11 Variant: nodeadkeys
     X11 Options: terminate:ctrl_alt_bksp
 > 

Can’t really test here – I’m not using a “Redmond” keyboard – the “Super R” (right hand Windows) key is “@” (plus an overlay for the KDE Plasma program starter) and, the unlabelled key to the right {between “Super R” and “Control R”} opens an active window dependent “right mouse click” menu …

Despite the differences, from the KDE System Settings –

  • I set the Compose key to the right hand Windows key (“Super R” key) – it changed to “Multi Key” in the Keyboard Preview and, retained it’s “@” functionality …
  • I then set the Compose key to the “3rd level of the right hand Windows key
    ” and, in the Keyboard Preview that key changed to “Super R” plus “Multi Key” as an “AltGr” alternative – the “@” functionality remained – sort of – no longer consistent … - I then set the Compose key to the Right Hand Control key – which then became the “Multi Key” – didn’t work at all …

At least for my keyboard, which I admit is somewhat “rare” and “unusual”, attempting to change the Compose key behaviour from the locale specific settings, doesn’t behave as expected.

The “Compose key” Wikipedia article has the following regarding X-Windows – <https://en.wikipedia.org/wiki/Compose_key&gt; –

X header files call the Compose Key the “Multi_key”. On Xorg the default Compose Key is <⇧ Shift+AltGr>

On this Leap 15.2 system and the default KDE Plasma, it doesn’t matter if <⇧ Shift+AltGr> or <AltGr+⇧ Shift> is used, the result is the same – the 4th level modifier is used …

Thank you for responding - I’m in AU so sometimes can not reply quickly. Thank you also for writing in English - Ich habe keine deutschen Sprachkenntnisse.
I am very glad to know the compose key is working for you - I thought it must be when I saw your well constructed post - that is what I want to achieve.

The Cherry keyboad is not well supported in AU, we never saw the Master Linux Keyboard here. My keyboard is a DAS (model DASK3MKPROCLI-CO) with a standard US layout connected by USB cable. It is not reported by lsusb. The output of localectl and locale is shown below:

$~> localectl
   System Locale: LANG=en_US.UTF-8
       VC Keymap: us
      X11 Layout: us
$~> locale 
LANG=en_AU.UTF-8
LC_CTYPE="en_AU.UTF-8"
LC_NUMERIC="en_AU.UTF-8"
LC_TIME="en_AU.UTF-8"
LC_COLLATE="en_AU.UTF-8"
LC_MONETARY="en_AU.UTF-8"
LC_MESSAGES="en_AU.UTF-8"
LC_PAPER="en_AU.UTF-8"
LC_NAME="en_AU.UTF-8"
LC_ADDRESS="en_AU.UTF-8"
LC_TELEPHONE="en_AU.UTF-8"
LC_MEASUREMENT="en_AU.UTF-8"
LC_IDENTIFICATION="en_AU.UTF-8"
LC_ALL=
$

When I change the compose key settings in KDE System Settings I observe similar results to those you describe. I believe that the selected key (Alt Right, in my case) is registered as the ‘compose key’ by KDE. The ‘preview’ label changes to ‘Multi key’, as expected. But it does not have any effect when typing. Image SUSE Paste
I have reached the point where I am randomly changing settings and hardware and re-testing, in hope of finding a clue to what is causing the interference.

Could you clarify how you use the ‘compose key’. I find the English information and guides curiously ambiguous about this. For example, they say: “Press the compose key and then press the code keys” but this could mean just about anything. Does one press and hold or press and release the compose key? Should the code keys be presses and released in sequence or pressed and held together? How is the code key sequence terminated?

Keyboard Preview image here. the blank key between Alt R and Ctrl R is a ‘Function Key’.

@Tallowwood:

Looking at your keyboard map, there aren’t any extra characters associated with the keys – my keyboard map is: <https://paste.opensuse.org/67421520>.
There’s a couple of things to check, starting with the Level3 key map options –


 > localectl list-x11-keymap-options | grep 'lv3'
lv3
lv3:alt_switch
lv3:bksl_switch
lv3:bksl_switch_latch
lv3:caps_switch
lv3:caps_switch_latch
lv3:enter_switch
lv3:lalt_switch
lv3:lsgt_switch
lv3:lsgt_switch_latch
lv3:lwin_switch
lv3:menu_switch
lv3:ralt_alt
lv3:ralt_switch
lv3:ralt_switch_multikey
lv3:rwin_switch
lv3:switch
lv3:win_switch
 > 
 > cat /usr/share/X11/xkb/rules/base.lst | grep 'lv3'
  lv3                  Key to choose the 3rd level
  lv3:switch           Right Ctrl
  lv3:menu_switch      Menu
  lv3:win_switch       Any Win
  lv3:lwin_switch      Left Win
  lv3:rwin_switch      Right Win
  lv3:alt_switch       Any Alt
  lv3:lalt_switch      Left Alt
  lv3:ralt_switch      Right Alt
  lv3:ralt_switch_multikey Right Alt; Shift+Right Alt as Compose
  lv3:ralt_alt         Right Alt never chooses 3rd level
  lv3:enter_switch     Enter on keypad
  lv3:caps_switch      Caps Lock
  lv3:bksl_switch      Backslash
  lv3:lsgt_switch      <Less/Greater>
  lv3:caps_switch_latch Caps Lock; acts as onetime lock when pressed together with another 3rd-level chooser
  lv3:bksl_switch_latch Backslash; acts as onetime lock when pressed together with another 3rd level chooser
  lv3:lsgt_switch_latch <Less/Greater>; acts as onetime lock when pressed together with another 3rd level chooser
 > 

You also need to check the X11 keyboard setting –


 > cat /etc/X11/xorg.conf.d/00-keyboard.conf 
# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "de"
        Option "XkbModel" "cymotionlinux"
        Option "XkbVariant" "nodeadkeys"
        Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection
 > 

Further things to try are here – <https://bbs.archlinux.org/viewtopic.php?id=254313> – <https://wiki.archlinux.org/index.php/X_keyboard_extension>

  • Are the packages “libX11-xcb1”, “libxcb-xkb1”, “libxkbcommon-x11-0”, “libxkbcommon0”, “libxkbfile1” and “xkbevd” installed?
  • Are the X11 keyboard utility packages installed? – “setxkbmap”, “xkbcomp”, “xkbprint” and “xkbutils” …
  • Are there any RPM package errors indicated by “rpm --verify --all” ?

I think the lack of extra characters is normal for US keyboard layout. They appear when I set a different layout, e.g. US International.

There’s a couple of things to check, starting with the Level3 key map options –

My system shows:-

> localectl list-x11-keymap-options | grep 'lv3'
**lv3**
**lv3**:alt_switch
**lv3**:bksl_switch
**lv3**:bksl_switch_latch
**lv3**:caps_switch
**lv3**:caps_switch_latch
**lv3**:enter_switch
**lv3**:lalt_switch
**lv3**:lsgt_switch
**lv3**:lsgt_switch_latch
**lv3**:lwin_switch
**lv3**:menu_switch
**lv3**:ralt_alt
**lv3**:ralt_switch
**lv3**:ralt_switch_multikey
**lv3**:rwin_switch
**lv3**:switch
**lv3**:win_switch
$~> cat /etc/X11/xorg.conf.d/00-keyboard.conf  
# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us"
EndSection
$~> cat /usr/share/X11/xkb/rules/base.lst | grep 'lv3'
  **lv3**                  Key to choose the 3rd level
  **lv3**:switch           Right Ctrl
  **lv3**:menu_switch      Menu
  **lv3**:win_switch       Any Win
  **lv3**:lwin_switch      Left Win
  **lv3**:rwin_switch      Right Win
  **lv3**:alt_switch       Any Alt
  **lv3**:lalt_switch      Left Alt
  **lv3**:ralt_switch      Right Alt
  **lv3**:ralt_switch_multikey Right Alt; Shift+Right Alt as Compose
  **lv3**:ralt_alt         Right Alt never chooses 3rd level
  **lv3**:enter_switch     Enter on keypad
  **lv3**:caps_switch      Caps Lock
  **lv3**:bksl_switch      Backslash
  **lv3**:lsgt_switch      <Less/Greater>
  **lv3**:caps_switch_latch Caps Lock; acts as onetime lock when pressed together with another 3rd-level chooser
  **lv3**:bksl_switch_latch Backslash; acts as onetime lock when pressed together with another 3rd level chooser
  **lv3**:lsgt_switch_latch <Less/Greater>; acts as onetime lock when pressed together with another 3rd level chooser

Further things to try are here – <[Solved] Right Alt key mapped to ISO_Level3_Shift in en(US) layout / Newbie Corner / Arch Linux Forums; – <https://wiki.archlinux.org/index.php/X_keyboard_extension&gt;
Thanks. I can not make much sense of the first. Second is useful reference.

  • Are the packages “libX11-xcb1”, “libxcb-xkb1”, “libxkbcommon-x11-0”, “libxkbcommon0”, “libxkbfile1” and “xkbevd” installed?
  • Are the X11 keyboard utility packages installed? – “setxkbmap”, “xkbcomp”, “xkbprint” and “xkbutils” …
  • Are there any RPM package errors indicated by “rpm --verify --all” ?

All installed and verified.

Then, may I suggest, use the US International layout and either <Multi_Key+«Key with the required compose character»> or <Multi_Key+Shift+«Key with the required compose character»> …

  • ←↓↑→ are all produced by <AltGr
    +Z or U or I> and <AltGr+Shift+U> on this keyboard …

When set the layout to US International (still showing Right Alt as Multi Key) the output is not modified.

Could you clarify how you use the ‘compose key’.

As I said, I find the information and guides ambiguous. For example, they say: “Press the compose key and then press the code keys” but this could mean just about anything. Does one press and hold or press and release the compose key? Should the code keys be presses and released in sequence or pressed and held together? How is the code key sequence terminated?

On my keyboard (french 105 keys) I have defined the compose key as the windows right key (next to the iso level3 shift)
I use the compose key generating some characters with the next sequence :

  1. press and release the compose key –> the very small character ⎄ is displayed
  2. Press shift + e –> Only E is displayed
  3. Press and release quote –> only É (capitalize E acute) is displayed
    other example: compose key + o + e –>œ is displayed
    Not all combinations exist. A lot of special characters can be generated but some are the same as those displayed with the iso level3 shift key

Using the iso level 3 shift key on my keyboard :

  1. press and maintain the iso key
  2. press and release A key –> æ is displayed

Regards
Philippe

@Tallowwood:

Almost the same here – except that I have nothing defined in KDE Plasma – the default Compose key seems to be <Shift+Control R> «Right Hand Control Key» –

  1. Press and release <Shift+Control R> – if there’s a character displayed, it’s very, very, small …
  2. Press and release <Shift+E> – nothing is displayed …
  3. Press and release <Shift+# «single quote»> – “É” is displayed.

Ditto <Compose Key>, release, “o”, release, “e” → “œ” is displayed.

Many thanks for the clear and helpful explanations phil524 and dcurisfra. I now know how the compose key should work. That will save time with testing.

It seems that a compose key is defined on my openSUSE Leap 15.2 system but that something is interfering with the way it operates in KDE Plasma.

I would be grateful if anyone who has a compose key working with a US keyboard layout could add a comment to this thread.

The Compose key can be defined in systemsettings ->Input devices ->Keyboard –> tab “Advanced” and therein choice “Position of Compose key”. You can maybe test after selecting a new compose key.

Regards
Philippe

I’ve raised the KDE Bug Report #436090 to deal with the undocumented default Compose Key assignment – <436090 – Keyboard default Compose Key not documented.

  • The default Compose Key assignment for my keyboard – 105-key German layout plus, Cherry CyMotion Linux physical device …

Please add votes to this Bug Report.

@Tallowwood:

It’s possibly best if you raise a new KDE Bug Report dealing with the Compose Key assignment issue for the Use Case of 104-key US layout keyboards.

  • You could however, add to the Bug Report I raised stating that, for the case of 104-key US layout keyboards, the default Compose Key assignment seems to be something other than <Shift+Control R> …

Thanks for all your help with this. As a confirmed ‘general user’ I find I can’t be much help with bugs. Perhaps the compose key is just a low priority for the developers. Their intention is not clear to me. I know I’m not the only one having issues with it, see here.

For now I am pondering JK’s advice here. Lots to learn.

@Tallowwood:

The KDE Bug Report has been closed with “RESOLVED NOT A BUG” –

No KDE code sets a default Compose key.

I’ve also checked with Lenovo G505s Laptop – <Shift+Control R> didn’t Compose …

  • I’ve setup the KDE System Settings Keyboard Advanced tab → Compose Key to be “3rd Level Chooser (AltGr)+Caps Lock” – that works for me …