Long press global shortcuts

Luca Weiss luca at z3ntu.xyz
Sat Jan 25 13:06:41 GMT 2020


On Freitag, 24. Jänner 2020 19:07:25 CET Aleix Pol wrote:
> On Sun, Jan 12, 2020 at 6:11 PM Aleix Pol <aleixpol at kde.org> wrote:
> > Hi,
> > In a discussion some weeks ago, we came to the conclusion that it
> > would make sense to support long press global shortcuts.
> > 
> > The use-case we discussed back then was the power button on the Plasma
> > phone. We need to have 2 actions upon press. Short press would lock
> > and dim the screen, long press would show the shutdown button.
> > Thinking about it further makes me think it's something we probably
> > want for the desktop use-case as well.
> > 
> > The problem is two-fold:
> > - We need to support long-press on kglobal accel (or even QShortcut?)
> > - When do we trigger the action? Because now it happens on pressed.
> > 
> > The second part of this is why I'm sending this e-mail. We're
> > responding to global shortcuts on press rather than on release, which
> > makes it impossible to handle the long press. Would it make sense to
> > change it to on release? Maybe only in the cases where there's a long
> > press counterpart?
> > 
> > Aleix
> 
> Hi,
> So I've been looking into it further and it turns out that the power
> button is special in libinput in that Press and Release are always
> emitted together upon press on my laptops (kde slimbook 1, dell xps
> 13, ms surface go). Good news is that on my nexus 5x it does the right
> thing. I wonder how reliable that is though.
> 
> I have no idea why that is, it could make sense to reach out to
> libinput upstream and they know what's going on.
> You can test it in your computer by using "sudo libinput debug-events".
> 
> https://phabricator.kde.org/D26899
> Here's a patch that should work, consequently we should implement
> Qt::Key_PowerDown on powerdevil and start removing the ad-hoc dpms
> management we do at the moment on hwcomposer.
> 
> Alternatively, we could also consider implementing it for double-press.
> 
> Aleix

Hi Aleix,

(first of all, I hope the email gets sent with the correct headers & recipients 
because I only got the email as digest and the import of mailman .gz archives 
doesn't work well)

Just to confirm, the PinePhone emits separate press and release events as well

 event0   KEYBOARD_KEY     +0.000s      KEY_POWER (116) pressed
 event0   KEYBOARD_KEY     +0.441s      KEY_POWER (116) released
 event0   KEYBOARD_KEY     +2.094s      KEY_POWER (116) pressed
 event0   KEYBOARD_KEY     +2.639s      KEY_POWER (116) released

I could test the KWin patch as well on the Pinephone but I'm not sure *how* to 
test it.

Cheers,
Luca




More information about the Plasma-devel mailing list