Summary: | keyboard layout of previous session is always loaded on start (X11) | ||
---|---|---|---|
Product: | [Applications] systemsettings | Reporter: | Domenico Panella <pandom79> |
Component: | kcm_keyboard | Assignee: | Plasma Bugs List <plasma-bugs> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | butirsky, nate, posting, vlad.zahorodnii |
Priority: | NOR | ||
Version: | 5.21.3 | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
URL: | https://invent.kde.org/plasma/plasma-desktop/-/issues/18 | ||
See Also: | https://bugs.kde.org/show_bug.cgi?id=431481 | ||
Latest Commit: | Version Fixed In: |
Description
Domenico Panella
2021-03-31 16:03:33 UTC
It probably because you have layout saving feature working. KWin saves layout along with the session. If you don't need this, set "Start new sesssion" in session settings, but then you won't get your session restored. Sorry if it's not intuitive. It was designed such way to not introduce new settings. I have "Start a new session" in my settings. Oh, sorry, what I said above belong to Wayland session only. Please check it works that way. For X11 session, I don't remember if that feature can be disabled at all. As a workaround, you could configure layouts in Xorg config and not in the Keyboard KCM. I did this test: I created a new user and logged in with Wayland. I created the same keyboard layouts and it also worked after reboot and poweroff command. I logged in with X11 as my user and now it also worked. I don't know what is happened but at the moment it's working fine. I close this bug as "Not a bug" Could you please check if the last used layout restores for you on Wayland when "Restore last session" is set? (In reply to Andrey from comment #5) > Could you please check if the last used layout restores for you on Wayland > when "Restore last session" is set? I checked that, on Wayland it restore fine while on X11 not restore last layout setted. Moreover, i set "Start new session" with these layout: English (us) (top) Italian (it). I expected the English keyboard layout set while the italian is set instead. Anyway, on X11 it not works properly as Wayland. According you, where is the problem? i see plasma-desktop/applets/keyboardlayout (is it plasmoid?) , plasma-workspace/components/keyboardlayout or anything else ? I could check that if you guide me. Please make sure you have "Global switching policy" for layouts in Keyboard KCM. I remember last used layout saving feature worked for X11 too with this policy when I first started to implement it for Wayland. IIRC, for "Application switching policy" X11 might have problems with the saving (still needs to be confirmed, it might be for "Windows" policy instead) but Wayland should work nevertheless. For "Global" policy it worked everywhere. If you want to check the code yourself, here is the class responsible for layout saving in X11: https://lxr.kde.org/source/kde/workspace/plasma-desktop/kcms/keyboard/layout_memory_persister.h Also please note the dependency on "Restore last session" exists for Wayland only - for X11, IIRC it should save unconditionally. X11 From my tests, the problem seems to be ".local/share/kded5/keyboard/session/layout_memory.xml" Option: "Start new session" Layout: "it,us" The layout defined in layout_memory.xml is always loaded. Is it correct? I expected the "it" layout is loaded because it is on top of the list. For some reason i have this file content: <!DOCTYPE LayoutMap> <LayoutMap version="1.0" SwitchMode="Global"> <item currentLayout="us"/> </LayoutMap> Now, If i change currentLayout from "us" to "it", it works fine! WAYLAND All works fine except when we restore the session. Some applications are not restored. I didn't see problems about keyboard layout instead. Questions: Option: "Restore previously saved session" Switch Policy: "Application, Windows, Desktop" Should it remember the keyboard layout for the applications? Same question for desktop and window. (In reply to Domenico Panella from comment #10) > X11 > > From my tests, the problem seems to be > ".local/share/kded5/keyboard/session/layout_memory.xml" > Option: "Start new session" > Layout: "it,us" > The layout defined in layout_memory.xml is always loaded. > Is it correct? I expected the "it" layout is loaded because it is on top of > the list. That doesn't matter as long as last used layout is saved. > For some reason i have this file content: > > <!DOCTYPE LayoutMap> > <LayoutMap version="1.0" SwitchMode="Global"> > <item currentLayout="us"/> > </LayoutMap> > > Now, If i change currentLayout from "us" to "it", it works fine! > That's where is was saved probably, as it should. Are you sure "us" wasn't your last used layout? Try to experiment with it a bit more. > WAYLAND > > All works fine except when we restore the session. > Some applications are not restored. > I didn't see problems about keyboard layout instead. > > > Questions: > > Option: "Restore previously saved session" > Switch Policy: "Application, Windows, Desktop" > > Should it remember the keyboard layout for the applications? > Same question for desktop and window. Yes, for all Switching Policies, layout should restore accordingly. Just for "Windows" Policy it's not fully implemented and works the same as for App policy. That belong to Wayland. For X11, I don't remember if saving layout for Application/Windows Policies work there. Please note for Wayland, layouts are saved in ~/.config/kxkbrc instead. (In reply to Andrey from comment #11) > (In reply to Domenico Panella from comment #10) > > X11 > > > > From my tests, the problem seems to be > > ".local/share/kded5/keyboard/session/layout_memory.xml" > > Option: "Start new session" > > Layout: "it,us" > > The layout defined in layout_memory.xml is always loaded. > > Is it correct? I expected the "it" layout is loaded because it is on top of > > the list. > > That doesn't matter as long as last used layout is saved. I mean, it's correct because as I said above, Option: "Start new session", etc. is irrelevant for layout saving on X11. If you have some basic C/C++ skills, you could make it work the same way as on Wayland, honoring Session restore option ;) I can guide you for the details. (In reply to Andrey from comment #13) > If you have some basic C/C++ skills, you could make it work the same way as > on Wayland, honoring Session restore option ;) > I can guide you for the details. On wayland, there are not problems about keyboard layout but the applications are not correctly restored. That works fine on X11 instead. Maybe that is another bug !? Yes, i could do that but before starting i'd want to ask some info. How can i contact you? Problems with session apps restore are irrelative to this, of course it's another "bug". There was work on that, too. You can access to me by email directly, if that won't be enough we'll decide further. Please report Wayland session restore problems to a separate bug and ping vlad.zahorodnii@kde.org and me there. Thanks. I'll post my email reply here for the reference: For restore session problem let's file an separate bug and cooperate with Vlad there because he was doing session things on Wayland. About layout saving, here you can see layoutMemoryPersister.restore() and layoutMemoryPersister.save() are called within constructor/destructor: https://lxr.kde.org/source/kde/workspace/plasma-desktop/kcms/keyboard/keyboard_daemon.cpp#0065 https://lxr.kde.org/source/kde/workspace/plasma-desktop/kcms/keyboard/keyboard_daemon.cpp#0076 That is why it always restores last layout used on X11 (if you have tick "configure layout" set in KCM). In Wayland, the restore occurs on SessionManager::loadSessionRequested() signal instead: https://invent.kde.org/plasma/kwin/-/merge_requests/38/diffs#26c78828a6ff7d1951c40f07b43aae8637a84588_72_102 You could try to simulate that behavior on X11. Please add me to MR if that happens. So what's the status of this? is everything working as expected on X11? It's otherwise - keyboard things (what is this issue about), - are all as expected on Wayland. It would need some efforts to bring that functionality to X11 part. It seems like Domenico is willing to participate in the developing. He will create an issue on Gitlab and we could continue there to guide him. Welcome Domenico! So the bug we're tracking here is that on X11, the last-used keyboard layout is unpredictible, and we want to move it to being saved by the session restore functionality, as it is on Wayland? I just want to make sure I understand. On X11, the last used layout is always restored, and there is no way to explicitly force exact predefined layout on start. On Wayland, it's possible by setting "Start new session" (vs "Restore previous session") - then topmost layout set in KCM will always take place on start. If I understand correctly, that missing functionality on X11 is the first thing wanted here. So saving last used layout feature is working on both platforms in some degree but it's only X11 where it can't be disabled. I see, so this is working as (currently) expected for each platform. Just I finished the other tests, i'll open an issue on Gitlab As it more feature request rather than a bug, the issue on Gitlab was opened for further discussion: https://invent.kde.org/plasma/plasma-desktop/-/issues/18 A possible MR is https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/416 Re-opening per https://bugs.kde.org/show_bug.cgi?id=431481#c15. Nate, don't you know if we could have X11-specific Keywoards or Flags here? None that are really in common use. Simply mentioning X11 in the title is probably enough. (In reply to Domenico Panella from comment #10) > X11 > > From my tests, the problem seems to be > ".local/share/kded5/keyboard/session/layout_memory.xml" > Option: "Start new session" > Layout: "it,us" > The layout defined in layout_memory.xml is always loaded. > Is it correct? I expected the "it" layout is loaded because it is on top of > the list. > For some reason i have this file content: > > <!DOCTYPE LayoutMap> > <LayoutMap version="1.0" SwitchMode="Global"> > <item currentLayout="us"/> > </LayoutMap> > > Now, If i change currentLayout from "us" to "it", it works fine! I am observing exactly the same issue in X11. In my case, I wanted it to use "de", but this file contains "us" and is unaffected by any changes I make to the configuration (short of removing the US keyboard layout entirely). (In reply to Stephen Bosch from comment #30) > (In reply to Domenico Panella from comment #10) > > X11 > > > > From my tests, the problem seems to be > > ".local/share/kded5/keyboard/session/layout_memory.xml" > > Option: "Start new session" > > Layout: "it,us" > > The layout defined in layout_memory.xml is always loaded. > > Is it correct? I expected the "it" layout is loaded because it is on top of > > the list. > > For some reason i have this file content: > > > > <!DOCTYPE LayoutMap> > > <LayoutMap version="1.0" SwitchMode="Global"> > > <item currentLayout="us"/> > > </LayoutMap> > > > > Now, If i change currentLayout from "us" to "it", it works fine! > > I am observing exactly the same issue in X11. In my case, I wanted it to use > "de", but this file contains "us" and is unaffected by any changes I make to > the configuration (short of removing the US keyboard layout entirely). If I manually set it by editing the layout_memory.xml, it sticks - for a time. I think it gets changed again if I then use the keyboard switcher at any time afterwards, and it doesn't seem to matter which other keyboard I use. And it also doesn't matter what keyboard was set when the session was ended. It always picks 'us'. My workaround for now is to set the file read-only (400). |