Skip to content

feat: add spare layouts support to Keyboard Layout applet

Andrey Butirsky requested to merge work/bam/spare_layouts into master

To support spare layouts in new Keyboard Layouts applet via existing DBus API, they are appended to the main ones and passed to the applet alongside in a row.
When spare layout selected in applet's context menu, layout swapping logic takes place - the spare layout activates and placed in last position of the main layouts loop, preempting previous layout there in current keymap.
That way the actual keymap can be dynamically modified from the menu, without reconfiguring in KCM.
No DBus API/applet changes are needed currently.

The behavior should correspond to the one old layout widget had.
For now, it's implemented for X11 only, as earlier.
Implementing for Wayland would require parsing layout configuration data (short name and variant) and storing it in KWin in a structured way, similarly how it's done in KCM. Currently we just pass strings from the config to XKB lib directly and store in KWin short layout names only.

This is especially useful when you have several layouts configured, and only few of them are needed on constant basis, while the others just occasionally.
Or when you need to decide what suits your needs best from multiple layout variants.

TODO:

  • add separator between main layouts and spare ones in the applet (optionally).
    Would need some way to pass separator position to the applet.

CCBUG: 430661

Edited by Andrey Butirsky

Merge request reports