Bug 370588

Summary: Global keyboard shortcut for KDE Daemon:Toggle Touchpad actually maps to Disable Touchpad
Product: [Applications] systemsettings Reporter: andydecleyre
Component: kcm_touchpadAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, alanm, andydecleyre, bugseforuns, bugzilla, burneddi, frederick888, kishore96, marceloatie, nate, ndcunliffe, rafneq, rajeeshknambiar, simonandric5, slartibart70, s_chriscollins, thesourcehim
Priority: NOR    
Version: 5.17.5   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description andydecleyre 2016-10-12 20:17:40 UTC
The behavior's the same with 5.8.0 and 5.8.1.

Triggering the shortcut for "Toggle Touchpad" disables the touchpad, and never enables it.

Reproducible: Always

Steps to Reproduce:
1. Configure a trigger for "Toggle Touchpad" in Global Keyboard Shortcuts:KDE Daemon
2. Activate the trigger to disable the touchpad
3. Activate the trigger to enable the touchpad

Actual Results:  
The touchpad is disabled, with the center-screen "Touchpad Off" notification displaying, twice.

Expected Results:  
The touchpad should first be disabled, but then enabled.

This is a pretty bad trap, as navigating the Global Keyboard Shortcuts window with the keyboard alone (to try to re-enable the touchpad after getting trapped without it) is a very difficult and ambiguous adventure, especially -- but not only -- because hitting Enter usually closes the window altogether for unknown reasons (when launched directly from krunner -- it seems to respond to keys differently when run as part of systemsettings).
Comment 1 Rajeesh K V 2016-10-14 04:17:45 UTC
Can you confirm the input driver?
$xlsatoms | grep -i tap

I have observed this behaviour in 5.8 as well, but there was no code change in touchpad daemon affecting this. Will take a closer look.
Comment 2 Luca Weiss 2016-10-14 05:40:34 UTC
I have the same problem (also in 5.7):

$ xlsatoms | grep -i tap
306     libinput Tapping Enabled
307     libinput Tapping Enabled Default
308     libinput Tapping Drag Enabled
309     libinput Tapping Drag Enabled Default
310     libinput Tapping Drag Lock Enabled
311     libinput Tapping Drag Lock Enabled Default
312     libinput Tapping Button Mapping Enabled
313     libinput Tapping Button Mapping Default
Comment 3 andydecleyre 2016-10-14 16:19:09 UTC
292     libinput Tapping Enabled
293     libinput Tapping Enabled Default
294     libinput Tapping Drag Enabled
295     libinput Tapping Drag Enabled Default
296     libinput Tapping Drag Lock Enabled
297     libinput Tapping Drag Lock Enabled Default
298     libinput Tapping Button Mapping Enabled
299     libinput Tapping Button Mapping Default
Comment 4 Rajeesh K V 2016-10-16 03:47:24 UTC
Can you also confirm the hardware? Is it by chance a Lenovo Yoga laptop?
Comment 5 Luca Weiss 2016-10-16 09:10:12 UTC
(In reply to Rajeesh K V from comment #4)
> Can you also confirm the hardware? Is it by chance a Lenovo Yoga laptop?

It's a Asus ROG G550JK
Comment 6 andydecleyre 2016-10-16 13:18:05 UTC
HP Zbook Studio G3 over here.
Comment 7 S. Christian Collins 2016-10-18 15:38:54 UTC
Also experiencing this bug.

** My System **
OS: KDE Neon 5.8.1 64-bit (Plasma Desktop 5.8.1, KDE Frameworks 5.27.0, Qt 5.7.0)
PC: HP Pavilion m6-1035dx
CPU/GPU: AMD A10-4600M APU with Radeon HD 7660G Graphics (using xorg radeon driver)
Linux Kernel: 4.4.0.43-generic
Comment 8 Rajeesh K V 2016-10-21 10:38:18 UTC
Is this issue always reproducible?
The problem I experience is when waking from sleep, touchpad is disabled (likely a kernel issue). Other than that, touchpad toggle is working as expected.

Run the below command before you press touchpad toggle short cut and report the output:
dbus-monitor "type='signal',interface='org.kde.kglobalaccel.Component'"

If possible, can you revert commit cf0bf81ccd4c7f8afacda7084978af719340a138 (you may need to revert ca23c39229d607fa45a2d862b44233163853739b first) and check if the issue persists?
Comment 9 Luca Weiss 2016-10-21 10:51:34 UTC
I pressed the toggle button two times. And it is always reproducible.

$ dbus-monitor "type='signal',interface='org.kde.kglobalaccel.Component'"
signal time=1477047033.062264 sender=org.freedesktop.DBus -> destination=:1.81 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.81"
signal time=1477047033.062294 sender=org.freedesktop.DBus -> destination=:1.81 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string ":1.81"

signal time=1477047039.599343 sender=:1.13 -> destination=(null destination) serial=1100 path=/component/kcm_touchpad; interface=org.kde.kglobalaccel.Component; member=globalShortcutPressed
   string "kcm_touchpad"
   string "Toggle Touchpad"
   int64 5992314
signal time=1477047041.263323 sender=:1.13 -> destination=(null destination) serial=1101 path=/component/kcm_touchpad; interface=org.kde.kglobalaccel.Component; member=globalShortcutPressed
   string "kcm_touchpad"
   string "Toggle Touchpad"
   int64 5993987
Comment 10 Rajeesh K V 2016-10-21 11:00:49 UTC
(In reply to Luca Weiss from comment #9)
Thanks.

> signal time=1477047039.599343 sender=:1.13 -> destination=(null destination)
> serial=1100 path=/component/kcm_touchpad;
> interface=org.kde.kglobalaccel.Component; member=globalShortcutPressed
>    string "kcm_touchpad"
>    string "Toggle Touchpad"
>    int64 5992314
> signal time=1477047041.263323 sender=:1.13 -> destination=(null destination)
> serial=1101 path=/component/kcm_touchpad;
> interface=org.kde.kglobalaccel.Component; member=globalShortcutPressed
>    string "kcm_touchpad"
>    string "Toggle Touchpad"
>    int64 5993987

Shortcut triggered twice in succession. Did you press the toggle shortcut twice, or just once?
Comment 11 Luca Weiss 2016-10-21 11:01:29 UTC
(In reply to Rajeesh K V from comment #10)
> (In reply to Luca Weiss from comment #9)
> Thanks.
> 
> > signal time=1477047039.599343 sender=:1.13 -> destination=(null destination)
> > serial=1100 path=/component/kcm_touchpad;
> > interface=org.kde.kglobalaccel.Component; member=globalShortcutPressed
> >    string "kcm_touchpad"
> >    string "Toggle Touchpad"
> >    int64 5992314
> > signal time=1477047041.263323 sender=:1.13 -> destination=(null destination)
> > serial=1101 path=/component/kcm_touchpad;
> > interface=org.kde.kglobalaccel.Component; member=globalShortcutPressed
> >    string "kcm_touchpad"
> >    string "Toggle Touchpad"
> >    int64 5993987
> 
> Shortcut triggered twice in succession. Did you press the toggle shortcut
> twice, or just once?

"I pressed the toggle button two times"
Comment 12 Luca Weiss 2016-10-27 16:39:10 UTC
Any new information?
Comment 13 Max 2016-11-26 13:42:26 UTC
Same problem on ASUS N56VB
Comment 14 nicholas 2016-11-27 17:59:35 UTC
i have the same problem on ASUS UX305 (using the default mapping FN-F9) 
opensuse tumbleweed on 5.8.4. 
[i have had to map ctrl-F9 to enable touchpad to prevent lockout]
Comment 15 slartibart70 2016-12-23 09:25:38 UTC
same problem on lenovo t420 laptop, kde, always reproducible.

touchpad toggle was working properly in fedora23/kde, but stopped in fedora25 (fresh install)
My workaround is to have the fn-touchpad toggle call a script which toggles the touchpad.
Still annoying, though...
Comment 16 Marcelo Atie 2017-01-07 18:26:41 UTC
Same problem on ASUS K46CB

openSUSE Leap 42.2
KDE Plasma 5.8.3
KDE Frameworks 5.26.0
Qt 5.6.1
Kernel 4.4.36-8-default
Comment 17 Raf 2017-01-12 22:35:49 UTC
I have the same problem. Touchpad toggle keyboard shortcut is only disabling touchpad. You cannot enable touchpad using this shortcut. I have tried with other key configurations and the result is the same. 

Hardware: Asus UX303 LN
Touchpad: FocalTechPS/2 FocalTech FocalTech Touchpad as /devices/platform/i8042/serio4/input/input5
Kernel: 4.4.36-8-default
OS: openSUSE 42.2
KDE Plasma: 5.8.3
KF: 5.26.0
Qt: 5.6.1

----------

As a workaround you have to assign different keyboard shortcuts for "touchpad enable" and "touchpad disable" actions in systemsettings. Those shortcuts work properly.
Comment 18 Alan Mimms 2017-03-11 19:25:27 UTC
This also affects me. I did the dbus-monitor experiment, hit the TOGGLE BUTTON twice in succession, and the very same "toggle" even happened but the screen showed the TOUCHPAD OFF display each time and the touchpad was, in fact, turned off.

I have Dell XPS 9350 running KDE neon 5.9.3.
Comment 19 Frederick Zhang 2017-03-15 05:39:29 UTC
Same issue here. Using Plasma 5.9.3 on Arch.
Comment 20 Raf 2017-03-15 19:35:15 UTC
*** This bug has been confirmed by popular vote. ***
Comment 21 Luca Weiss 2017-03-16 12:24:15 UTC
I might have identified the issue.
propertyChanged() in xlibbackend.cpp doesn't get called (which calls updateCurrentState() in kded.cpp) when the touchpad is disabled but is called when it gets enabled. That leaves a part of the stack to believe that the touchpad is still enabled and tries to set the touchpad to !isEnabled -> disabled.
A very quick and dirty fix is adding "m_touchpadEnabled = m_userRequestedState;" to the end of the toggle() method in kded.cpp which lets the kded.cpp believe that the touchpad is disabled even though another part of the stack still believes the touchpad is enabled (that's why it's "dirty").
Comment 22 andydecleyre 2017-08-04 03:10:00 UTC
I honestly think this behavior is bad enough that the responsible thing to do is remove the toggle shortcut altogether -- immediately -- until/unless it's fixed (leaving the separate enable and disable shortcuts in place).
Comment 23 Christoph Feck 2017-08-28 00:27:54 UTC
*** Bug 381307 has been marked as a duplicate of this bug. ***
Comment 24 Christoph Feck 2017-08-28 00:28:04 UTC
*** Bug 383145 has been marked as a duplicate of this bug. ***
Comment 25 Nate Graham 2017-10-23 03:09:05 UTC
There's a patch working its way through the review process that should fix this: https://phabricator.kde.org/D3829
Comment 26 Albert Astals Cid 2018-02-14 23:56:23 UTC
One day phabricator will stop being stupid and messing up my commits.