Skip to content

Conversation

@wismill
Copy link
Member

@wismill wismill commented Nov 18, 2025

Currently each toolkit (Gtk, Qt, etc.) implements its strategy to deal with keyboard shortcuts on non-Latin layouts. See e.g.:

Tweak keyboard shortcuts by adding the option to switch to a different group when some modifiers are active (typically Control, Alt or Super). The target group can be set for each group, although the most common use case would probably be the same target for all layouts.

It works by specifying:

  • A modifier mask to watch, typically Control, Alt and Super.
  • A mapping: source layout → target shortcuts layout.

Then whenever the active modifiers contain some of the modifiers of the mask
defined hereinabove, the active layout is switched to the target layout defined
in the mapping, if any, otherwise it is left unchanged.

This can be alternatively activated (for now) with the environment variables XKB_UNSTABLE_EXPERIMENTAL_SHORTCUT_MASK and XKB_UNSTABLE_EXPERIMENTAL_SHORTCUT_TARGET_LAYOUTS. This enables to use the new feature even if the DE does not implement a UI to configure it. While the names suggests that this setting method is temporary, I am unsure we should ship it: I do not want to see this setting method broadly used so that we cannot change/remove it later. It is more a mean for early adopters hackers to test the feature by installing their own local version of libxkbcommon.

Fixes #753
Closes #739

TODO:

  • Ensure the tweak is applied in all relevant code paths
  • Improve doc (FAQ, etc.)
  • Remove environment variable support

This is a refactor of #739, which uses an obsolete approach with Wayland issues.

@wismill wismill added this to the 1.14.0 milestone Nov 18, 2025
@wismill wismill added the state Indicates a need for improvements or additions to the xkb_state API label Nov 18, 2025
@wismill wismill marked this pull request as draft November 18, 2025 16:28
@wismill wismill mentioned this pull request Nov 18, 2025
4 tasks
Currently each toolkit (Gtk, Qt, etc.) implements its strategy to deal
with keyboard shortcuts on non-Latin layouts. There are some edge
cases where this does not work:
- Punctuation is usually not remapped. E.g. the standard Israeli
  layout cannot remap its key <AD01> “slash” to the US layout “q”.
- If one have multiple Latin layouts, shorcuts may be positioned
  differently. E.g. US Qwerty and French Azerty have different
  positions for Ctrl+Q, while the user might want all shortcuts to
  be positioned independently of the layout.

This commit enables tweaking keyboard shortcuts by adding the option
to switch to a different layout when some modifiers are active, typically
`Control`, `Alt` or `Super`. The target layout can be set individually
for each source layout, although the most common use case would probably
be the same target for all layouts.

Added to the keymap compile options API:
- `xkb_state_machine_options_shortcuts_update_mods()`
- `xkb_state_machine_options_shortcuts_set_mapping()`
@wismill wismill force-pushed the state/shortcut-tweaks branch from 491748b to d37003c Compare November 18, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state Indicates a need for improvements or additions to the xkb_state API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

keyboard shorcuts: issue with non-Latin layout

1 participant