Bug 461097 - kded does not save per-application keyboard layout settings anymore
Summary: kded does not save per-application keyboard layout settings anymore
Status: REPORTED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keyboard (show other bugs)
Version: unspecified
Platform: Other FreeBSD
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-28 05:41 UTC by Martin
Modified: 2024-02-20 19:36 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin 2022-10-28 05:41:06 UTC
Scenario:
- FreeBSD 12.3 latest
- ports as of Oct 13, specifically kf5-kded-5.98.0
- using "per-application" keyboard layout settings
- using "German (Austria)" for some (e.g., thunderbird), "English (US)" (which is also the default) for the rest
- normally, keyboard layout settings are saved into the file .local/share/kded5/keyboard/session/layout_memory.xml
- until a while ago, thunderbird seemed to use a WM_CLASS of "Thunderbird" (inferred from the contents of the layout_memory.xml file)
- currently, it uses "Mail", "thunderbird"
- The contents of the layout_memory.xml file were:

[0]% cat .local/share/kded5/keyboard/session/layout_memory.xml
<!DOCTYPE LayoutMap>
<LayoutMap version="1.0" SwitchMode="WinClass">
 <item currentLayout="at" layouts="us,at" ownerKey="Thunderbird"/>
 <item currentLayout="at" layouts="us,at" ownerKey="dolphin"/>
 <item currentLayout="at" layouts="us,at" ownerKey="okular"/>
 <item currentLayout="at" layouts="us,at" ownerKey="soffice.bin"/>
</LayoutMap>
[0]% 

Result:
- When logging in again, thunderbird gets the layout "English (US)"

Expected result:
- As for dolphin and okular, the layout should be remembered for thunderbird across session close/open.

Analysis:
- The file .local/share/kded5/keyboard/session/layout_memory.xml still gets read
- This can be seen by added the following line to it:

 <item currentLayout="at" layouts="us,at" ownerKey="thunderbird"/>

- (note the lower-case "t")
- With this line, after a new login (session) thunderbird immediately starts with the "German (Austria)" keyboard layout
- Obviously, on logout (or probably whenever the keyboard layout for an application is changed) the file is not updated anymore; this can also be observed from its modification time.

FreeBSD PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267368
Comment 1 Nate Graham 2022-10-28 20:01:02 UTC
What Plasma version are you using? 5.26?
Comment 2 Martin 2022-10-29 07:02:53 UTC
This is plasma 5.24.6.
Comment 3 Andrew Shark 2023-08-08 13:46:47 UTC
Repro steps are not clear. When does ` ~/.local/share/kded5/keyboard/session/layout_memory.xml` file is written?
At each current layout change? At application exit? At session exit? Is it X11 specific?

For me, it is not saved at app exit. Its content is:
```
<!DOCTYPE LayoutMap>
<LayoutMap version="1.0" SwitchMode="WinClass"/>
```

My steps:
Set per application layout switching in system settings.
Run Thunderbird in X11 mode, switch to Russian layout.
Alt-tab to any another app (for example Konsole), set to US layout (if not yet).
Alt-tab back to Thunderbird. You see the layout is RU (as expected, because it was left in RU).
Exit Thunderbird with Ctrl + Q.
Launch Thunderbird.

Observed result:
The layout is US.

Expected (?) result:
The layout is what it was last left, i.e. RU.

Is it how it is expected to work?
Comment 4 Martin 2024-02-20 19:36:02 UTC
I just added updated info to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267368.

Replying to Andrew - sorry for the late reply: It is saved while staying in a session, but previously it was saved permanently, i.e., through a logout/login.

-- Martin