Bug 422038 - Plasma Alt- & Super- shortcuts malfunction when both left and right Alt key are configured by XKB
Summary: Plasma Alt- & Super- shortcuts malfunction when both left and right Alt key a...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: 5.18.5
Platform: Kubuntu Linux
: NOR normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-25 07:32 UTC by cantoraz
Modified: 2022-02-19 04:48 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cantoraz 2020-05-25 07:32:32 UTC
SUMMARY

Plasma ALT- & SUPER- shortcuts stop working when the right Alt key as Level3 switcher, and at the same time, the left Alt is swapped/re-mapped with other modifier key.

To be exact, this bug only happens when all following conditions are met:
+ The right Alt key is used to choose the 3rd level, whatever it is implicitly included by the layout containing 3 levels, or explicitly set by users.
+ The Left Alt key is mapped as other modifier by XKB options.
  For example, either one of following two options is a good choice for test.
  - "Ctrl Position: Left Alt as Ctrl, Left Ctrl as Win, Left Win as Left Alt"
  - "Ctrl Position: Swap Left Alt with Left Ctrl"

The utilities `setxkbmap` and `xev` show XKB settings are correct and take effect.

As the result, if the left Alt key is mapped as other modifier, the right Alt key couldn't choose the 3rd level. If the right Alt act as the level3 switcher, the left Alt key couldn't be mapped as other modifier.

Then, explicitly disable the right Alt as the level3 switcher by check additional XKB option "Key to choose the 3rd level: Right Alt never choose 3rd level". ALT- & SUPER- Shortcuts work again, at the cost of disability to input the 3rd level letters.

For the sake of unambiguity, I use following notation:
- `SUPER` is always used as the modifier name of `Win` or `Command` keys, although KDE settings/documentations prefer `META`.
- The phisical key is represented in `lowercase`, eg: Win key `win`, Alt key `atl`, Left Alt key `lalt`, Right Alt key `ralt`, etc.
- The modifier symbol is represented in `UPPERCASE`, eg: `SUPER`, `ALT`, `ALT_L`, `ALT_R`, etc.
- Intepreted key combination symbol is represented in parentheses along with phicial keys pressed, eg: `alt-tab` (`ALT-TAB`), `win-d` (`SUPER-D`), etc.

STEPS TO REPRODUCE
1. Connect a PC 104-Key (US ANSI) Keyboard.
2. Reset the global shortcuts to defaults. Eg: 
  - `ALT-F1` Activate Application Launcher Widget
  - `ALT-F2` KRunner
  - `ALT-TAB` Walk through windows
  - `SUPER-D` Show Desktop
  - `SUPER-Q` Activities…
  - `SUPER-TAB` Walk through Activities
3. Open "System Settings > Hardware > Input Devices > Keyboard".
4. In "Hardware" tab, choose "Generic 104-key PC" for keyboard model.
5. In "Layouts" tab, add a keyboard layout "English (US)", with "US, international AltGr Unicode combining". This layout has 3 levels, and implicitly includes `level3(ralt_switch)` in its XKB config file.
6. In "Advanced" tab, expand "Ctrl Position" tree, check the option "Left Alt as Ctrl, Left Ctrl as Win, Left Win as Left Alt".

OBSERVED RESULT

+ `raltb` (right Alt) key chooses the 3rd level as expected. It's OK.

+ `lalt` (left Alt) key behaves like `CTRL` as expected. It's OK.

+ But `lwin` (left Win) key doesn't behave like `ALT` properly:
  - `lwin` (`ALT`) can active mnemonics underlined, but can't trigger corresponding menu item with the mnemonic letter
  - `lwin-f1` (`ALT-F1`) doesn't trigger "Activate Application Launcher Widget"
  - `lwin-f2` (`ALT-F2`) doesn't trigger "KRunner"
  - `lwin-tab` (`ALT-TAB`) doesn't trigger "Walk through windows"
  - `lwin-f` (`ALT-F`) / `lwin-b` (`ALT-B`) don't "Forward/Backward one word" in terminal (Emacs style cursor moving)

  Actually, `lwin-` key combinations still behave like `SUPER-`, rather than expected `ALT-`:
  - `lwin-d` (`ALT-D`) triggers `SUPER-D` "Show Desktop"
  - `lwin-q` (`ALT-Q`) triggers `SUPER-Q` "Activities…"
  - `lwin-tab` (`ALT-TAB`) triggers `SUPER-TAB` "Walk through activities"

+ But `lctrl` (left Ctrl) key doesn't behave like `SUPER` properly:
  Besides that `lctrl` (`SUPER`) itself can only trigger "Application Dashboard" after re-login Plasma, it doesn't behave like `SUPER` any more:
  - `lctrl-d` (`SUPER-D`) doesn't trigger "Show Desktop"
  - `lctrl-q` (`SUPER-Q`) doesn't trigger "Activities…"
  - `lctrl-tab` (`SUPER-TAB`) doesn't trigger "Walk through activities"

EXPECTED RESULT

+ `ralt` key chooses the 3rd level:
  `ralt-a` prints `á`, `ralt-e` prints `é`, `ralt-o` prints `ó`, etc.

+ `lalt` key behaves like `CTRL`:
  - `lalt-c/v/x/z` behave like `CTRL-C/V/X/Z` in an editor
  - `lalt-a/e/f/b` behave like `CTRL-A/E/F/B` in a terminal (Emacs style cursor moving)

+ `lwin` key behaves like `ALT`:
  - `lwin-f1` (`ALT-F1`) triggers "Activate Application Launcher Widget"
  - `lwin-f2` (`ALT-F2`) triggers "KRunner"
  - `lwin-tab` (`ALT-TAB`) triggers "Walk through windows"
  - `lwin-f` (`ALT-F`) / `lwin-b` (`ALT-B`) can "Forward/Backward one word" in terminal (Emacs style cursor moving)

+ `lctrl` key behaves like `SUPER`:
  - `lctrl-d` (`SUPER-D`) triggers "Show Desktop"
  - `lctrl-q` (`SUPER-Q`) triggers "activities…"
  - `lctrl-tab` (`SUPER-TAB`) triggers "Walk through activities". (though not immediately, but can do after re-login Plasma)

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 20.04
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8

ADDITIONAL INFORMATION

This bug can be reproduced on Arch Linux in physical box and Kubuntu 20.04 LiveCD in VirtualBox too.

Linux/KDE Plasma: Arch Linux
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.70.0
QT Version: 5.14.2

Linux/KDE Plasma: Kubuntu 20.04 LiveCD
KDE Plasma Version: 5.18.4
KDE Frameworks Version: 5.68.0
QT Version: 5.12.8

But on KDE neon 5.14 in VirtualBox, everything just works fine.

Linux/KDE Plasma: KDE neon 5.14 (20190103-0529)
KDE Plasma Version: 5.14.4
KDE Frameworks Version: 5.53.0
QT Version: 5.11.2

Probably this bug is brought in by recent Plasma/KF/QT versions.
Comment 1 cantoraz 2022-02-19 04:48:08 UTC
It'd already been fixed.