https://bugs.kde.org/show_bug.cgi?id=452445

Vlad Zahorodnii <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
      Latest Commit|                            |https://invent.kde.org/plas
                   |                            |ma/kwin/-/commit/a9b33800eb
                   |                            |e5dbd191292addeb87a92772a1e
                   |                            |9ae

--- Comment #27 from Vlad Zahorodnii <[email protected]> ---
Git commit a9b33800ebe5dbd191292addeb87a92772a1e9ae by Vlad Zahorodnii, on
behalf of Marián Kadaňka.
Committed on 27/10/2026 at 07:46.
Pushed by vladz into branch 'master'.

keyboard_layout: Keep an application's layout after its last window closes

In System Settings -\> Keyboard -\> Keyboard -\> Configure Switching,
"Switching layout affects" is set to "All windows of current application". It
works for regular applications, and yet in Yakuake (terminal emulator), every
time I switch the layout to English while the Yakuake window is open, then
switch to some other application and back to Yakuake, Yakuake gets the system
default (Slovak) layout back. It works as expected on X11.

The cause is that ApplicationPolicy keeps layouts by window and drops the entry
when the window closes. Yakuake (with "Keep window open when it loses focus"
setting off) hides its window when it lose focus, which on Wayland destroys it
so every time it is shown again it is a new window and nothing is there to
inherit the layout from. The same happens to any application after its last
window is closed. On X11 it was handled by kded keyboard module that kept
layouts by window class, so it worked.

This change keeps the layout of an application's last window under its desktop
file name when the window closes (in m_layoutsRestored) which is already used
when an application's first window is activated. Those entries are also saved
with the session so the layout also survives logout when the session is
restored.

How to test it:

- added integration test testApplicationPolicyLastWindowClosed (closes an
application's last window, opens a new one, and checks the layout comes back,
also across a session save and restore), it fails on un-patched KWin and pass
with this patch
- have at least 2 keyboard layouts set in System Settings, non-English with
higher priority, then launch Yakuake, switch to keyboard layout to English,
focus another application so Yakuake hides, show Yakuake again - layout stays
English
- close some application on English layout, log out and back in, open it again
- layout would be English
- running it on Plasma 6.8.0 (KDE Neon)
Related: bug 476831

M  +39   -0    autotests/integration/keyboard_layout_test.cpp
M  +28   -1    src/keyboard_layout_switching.cpp
M  +1    -0    src/keyboard_layout_switching.h

https://invent.kde.org/plasma/kwin/-/commit/a9b33800ebe5dbd191292addeb87a92772a1e9ae

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to