[Bug Fix] :: Fix Spare layout feature on Wayland

I like the idea of sponsored bugfixes.
One of cool feature that I use is Spare layout.

For configurations with more than two keyboard layouts it allows switching between N latest using single keyboard shortcut.

When used together with per-layout shortcut it allows something like followed (assuming that Meta+3 is configured to trigger layout 3 and Caps-Lock is configured to cycle between layouts)

  • layout 1 is active
  • Caps Lock switches to layout 2
  • Caps Lock switches to layout 1
  • Caps Lock switches to layout 2
  • Meta+3 switches to layout 3
  • Caps Lock switches to layout 2 (latest used)
  • Caps Lock switches to layout 3
  • Caps Lock switches to layout 2

Unfortunately this doesnā€™t work with Wayland.

Bug: 455431 ā€“ Spare layout not working on Wayland

Iā€™ll donate $50 USD once fix is merged.

2 Likes

This has basically just been implemented with Add toggle previous keyboard layout shortcut (!1722) Ā· Merge requests Ā· Plasma / Plasma Desktop Ā· GitLab.

1 Like

Excellent!.

Author of pull requests donā€™t want to get that $50.

I think Iā€™ll add my $50 to one of other bug reports

1 Like

Hey @dion ,

is it really working like this for you in X like you described it above? Because from what I understood (and what I am experiencing), after you press on Meta+3, it will not toggle between 2 and 3, but it will toggle between 1 and 3.

BR
Mihail

Hi,

Sorry for late responseā€¦ Yes. I think you are right. Most likely itā€™ll switch between 1 and 3 on X11. But personally I donā€™t care about this.

My usual use case is to do followed:

  • Often 1-2
  • Sometimes 1-3
  • VERY rarely 2-3

Iā€™m fine with pressing a few times Meta+1,3 to ā€˜warm upā€™ list of latest layouts :slight_smile:

I finally upgraded to Plasma 6 (since itā€™s now available in Debian Unstable). And I was able to configure ā€˜acceptableā€™ behavior. Unfortunately itā€™s much more difficult nowā€¦ I can configure ā€˜Caps Lockā€™ to switch layouts but unfortunately Caps key also toggles ā€œCaps Lockā€ā€¦ The only way to fix it was to remap Caps Lock to F13 using GitHub - katie-jones/xkeyboard-config-f13: Modify xkb configuration files to add a layout option mapping the Caps Lock key to F13. (with a few more changes to make it work with Plasma on Debian). Then I was able to map F13 as ā€œSwitch to last used layoutā€. Unfortunately it requires changes to xkb-data packageā€¦

PS. I still want to ā€˜sponsorā€™ coffee for thisā€¦ So Iā€™m adding $50 more for this. So itā€™ll be total $100 to make it work without this F13 hack.