Bug 397971 - Mouse button settings (handedness) lost after suspend to RAM
Summary: Mouse button settings (handedness) lost after suspend to RAM
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_mouse (show other bugs)
Version: 5.13.4
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Roman Gilg
Depends on:
Reported: 2018-08-28 06:54 UTC by slartibart70
Modified: 2022-02-12 10:11 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:

mouse-settings (30.83 KB, image/png)
2018-08-31 12:17 UTC, slartibart70

Note You need to log in before you can comment on or make changes to this bug.
Description slartibart70 2018-08-28 06:54:57 UTC
I am using a script in 
which runs at plasma-startup (and can also be found as script-entry in systemsettings/autostart).
This script calls 3 other scripts for setup of touchpad and mouse parameters, esp. the handedness of the mouse (left handed) by calling for example
xinput set-prop $mouseId "libinput Left Handed Enabled" 0

Since upgrade to fedora28/plasma 5.13, the following problem occurrs:
- initial startup of plasma is ok, mouse settings are applied
- suspend laptop to RAM
- wake up again
- mouse settings are gone, mouse operates as right-handed mouse.

Yes, i can manually call the script again, then my settings are of course reapplied.
But, up to fedora27 this approach was valid and even suspend did not override the settings

- is it possible to run my init script automatically after suspend/wakeup?
- even better... could this bug be fixed, so that the settings survive a suspend/wakeup cycle?
Comment 1 slartibart70 2018-08-28 07:57:13 UTC
some more info coming from Peter Hutterer/libinput
usually what happens during suspend is that all devices are removed and then added again on resume. Basically the same as on plug/unplug. Since you're applying run-time settings only, these don't get applied to new devices (you can test this by unplugging your mouse). Same problem here.

Check your xorg.log, if it says "device removed" and whatnot before suspend, then this is the issue. I think the only way this could've worked in F27 is if the script got called on resume. The device removal has been like this for quite a while now.

and yes, we have the entry in the logs
[146935.893] (II) event8  - (II) Logitech M525: (II) device removed

Then this seems to be plasma related only?
Any idea what did change in the handling of those autostart scripts?
Comment 2 Nate Graham 2018-08-28 19:21:47 UTC

*** This bug has been marked as a duplicate of bug 395401 ***
Comment 3 Patrick Silva 2018-08-29 16:18:45 UTC
This report is about libinput, bug 395401 is about evdev.
Comment 4 slartibart70 2018-08-30 06:07:56 UTC
well, as Peter Hutterer pointed out, this is NOT libinput related, instead, this seems to be about the handling of startup scripts in plasma after a suspend/wakeup cycle
Comment 5 Nate Graham 2018-08-30 18:23:08 UTC
Are you only using this script as a workaround for the fact that the settings aren't remembered across reboots?
Comment 6 slartibart70 2018-08-30 18:29:03 UTC
no, i wanted to apply settings available only using libinput, so that's the main reason.
And it's just working (ok, _was_ working) as i expected.
I am adjusting lenovos T470 touchpad, mouse and lenovo pointer-stick (the red thing on the keyboard) using libinputs acceleration profiles and handedness. Plasma mouse settings never came close to the options of libinput
Comment 7 Nate Graham 2018-08-30 18:33:58 UTC
In Plasma 5.13, it does have a checkbox for "left handed mode" though (and other stuff). Is there any reason why you can't use it?
Comment 8 slartibart70 2018-08-30 19:03:08 UTC
yes, there is  A left handed mouse using plasma settings does react completely different in gimp!!
Gimp does not like button remappings (i assume), so a right handed mouse works ok, a left handed not. And, same applies to an external touchpad/drawing pad (wacom) which uses left handed settings of the mouse somehow. Same problem.... libinput to the rescue ;-)
Comment 9 Nate Graham 2018-08-30 19:11:51 UTC
In Plasma 5.13, the mouse settings panel *does* use libinput. Can you share a screenshot of what it looks like for you, please?
Comment 10 slartibart70 2018-08-30 21:43:22 UTC
i know what you're talking about, i'm pretty sure mybscreen is the same as yours. But a left handed mouse setup (plasma setting) does a button remap which affects wacom pen as well. I cannot set left handed mouse exclusively and wacom pen right handed. And, moreover, my command (see first post) does something different to the mouse without affecting wacom. so i really would like to keep this freedom ;-)
Comment 11 Nate Graham 2018-08-30 21:50:10 UTC
Yes, nobody wants to remove your freedom, but rather, we want to resolve the bug that you're working around so you don't have to keep working around it. :)

The reason why I ask you to share a screenshot is because the old evdev interface did a button re-map, but libinput does not; it actually supports the concept of a left-handed mode. So if our attempts to expose this through the UI did not work, we need to fix that. So I'd like you to show me that screenshot so I can verify that you're actually using the libinput interface (in which case there is a but with it) rather than the old evdev interface (in which case you should try the libinput one first).
Comment 12 slartibart70 2018-08-30 22:27:20 UTC
agreed ... will check again and keep you updated
Comment 13 slartibart70 2018-08-31 12:17:01 UTC
Created attachment 114717 [details]
Comment 14 slartibart70 2018-08-31 12:32:38 UTC
some updates (and a screenshot :-)
1) mouse and trackpoint settings are related to each other - that is, i cannot set mouse to left-handed and the trackpoint(lenovo t470) to right handed 
(you know, with 2 hands - mouse left, right hand on keyboard, i choose _my_ preferences :-))
In plasma, there is still no property-panel for trackpoint settings

2) initialization of touchpad
i am using

xinput set-prop $touchpadId "libinput Click Method Enabled" 0 1

to get rid of the lower-button-like sensitive areas of the touchpad (so i can use the whole area)
In plasma touchpad settings, those options are still greyed out

2a) entering the property panel of touchpad gives me (first time access) an error-like message (red hint area on top of panel) that my current settings are not being displayed - with an option/button to do so.
Afterwards, the touchpad does have other sensitivity settings as before (so this seems not to be just an update of the panel-display?). And, i did not really notice any differences in the values of the panel in comparison to before the button click

3) sudden loss of mouse-handedness
i have experienced today a sudden loss of mouse-handedness... (without 'playing' in the systemsettings panel). Mouse setup was done using libinput script and i was using chrome (left-handed). Then, the mouse suddenly was right-handed, because clicking now opened a context menu??? (ok, i experienced this only once)

4) update to suspend/wakeup
I have opened this bugreport because the mouse/trackpoint/touchpad settings were apparently not reapplied when waking up. In the meantime, i had several suspend/wakeup cycles where the mouse settings survived the sleep-period...
So, maybe (with topic 3 above), this is not really related to the processing of startup-scripts but something else in plasma? Just wondering...
Comment 15 slartibart70 2018-08-31 12:57:12 UTC
update for startup scripts:

According to journalctl -b -0, the script gets called only after logoff/login, and not after suspend/wakeup

I can only find the line
ksmserver[11905]: org.kde.kf5.ksmserver: autostart script ("/home/user/.config/autostart-scripts/kde_init.sh") finished with exit code  0

when doing a logoff/login cycle
Comment 16 slartibart70 2018-09-02 13:43:40 UTC
I encountered the mouse-handedness being lost now multipe times on 2 different machines (desktop w/o suspend and laptop).
Both incidents were without suspend/wakeup cycle, just the screensaver kickin' in...
This is really annoying, if your mouse handedness suddenly changes !!!
Comment 17 Roman Gilg 2018-09-03 22:57:40 UTC
The Mouse KCM has a kcmInit hook, which sends the current settings on every reboot and apparently also on wake up after suspend to the Xserver.

It was this way before that as well, just that our libinput KCM didn't support setting the handedness, so it didn't try to reapply it on wake up. Now it does, so it overwrites your script setting. But there should be no difference in how it behaves in GIMP in comparison to when you set it through xinput.

The problems you describe later about settings of touchpads and mice being dependent on each other is dealt with in: https://phabricator.kde.org/D15256

Setting the report to invalid, since the KCM is meant to resend settings to the Xserver and did it this way in the past as well, just not the handedness with libinput because it didn't support it. Also there should be no difference in GIMP to setting it through xinput.
Comment 18 Gerry Gavigan 2021-03-05 11:43:34 UTC
and now on logout or reboot but peculiarly only on my Intel based laptop and not my Ryzen based desktop.

using latest Tumbleweed

There is another bug somewhere describing the effect as occasional and random (reported by me) that I cannot find in which a KDE developer suggested that the problem was caused by an unidentified application was triggering an event unnecessarily
Comment 19 Gerry Gavigan 2021-12-12 18:18:38 UTC
In current Tumbleweed the not respecting left-handedness problem has reawakened from the apparent dead and seems to be interacting with Bluetooth, which doesn't always respect the state it was set to after power off or log out. Further there seems to be some process that takes its time before telling me my Bluetooth mouse is connected, which is new. Not sure if it is a system settings problem or  a Bluetooth problem
Comment 20 Gerry Gavigan 2021-12-13 20:19:48 UTC
I've now identified that the behaviour is unrelated to the setting in system setting>input devices>mouse
Comment 21 Gerry Gavigan 2021-12-25 12:48:43 UTC
on occasion, when logging on the mouse is right-handed but the system shows left-handed option selected. To achieve left-handness it is necessary to toggle-off, apply, toggle-on, apply
Comment 22 Nate Graham 2022-02-11 22:02:01 UTC
This bug report is too confusing as it has been used for many different things; let's track the issue of settings being reset after login/suspend when *not* using a custom script with Bug 435113.
Comment 23 slartibart70 2022-02-12 10:11:48 UTC
i'm closing this specific bug, as with newer versions of plasma there is no need any more to set mouse/touchpoint/touchpad handedness by script - systemsettings does what is required for me.
I think the problem was, that libinput being fed by script and systemsettings using the 'old style' of applying handedness was the culprit.
Using plasma 5.23.5 all is fine so far