Re: Long press global shortcuts
On Freitag, 24. Jänner 2020 19:07:25 CET Aleix Pol wrote: > On Sun, Jan 12, 2020 at 6:11 PM Aleix Pol 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
Re: Long press global shortcuts
On Sun, Jan 12, 2020 at 6:11 PM Aleix Pol 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
Re: Long press global shortcuts
On 1/14/20 1:07 PM, Aleix Pol wrote: We are talking about shortcuts for physical keys (e.g. keyboard, the 3 or 4 buttons you'd have on a phone). Oh my mistake, sorry. One thing I miss from macOS is long-pressing a key on the keyboard to display a pop-up containing accented and other non-Latin versions of that character. It was much more discoverable and user-friendly than using a compose key shortcut or an IBus input method. This behavior was implemented on long-press (not release) for keyboard keys, so if the proposed change would allow us to gain something like this, that would be nice. Nate
Re: Long press global shortcuts
On Tue, Jan 14, 2020 at 9:05 PM Nate Graham wrote: > > On 1/12/20 10:11 AM, Aleix Pol wrote: > > 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? > > It might depend on what action the long-press is going to trigger. For > long-press to show a mobile-friendly grid-based context menu, it might > be nice to be able to long-press, slide your finger over to the item you > want to select, then release it. In this case, the release would trigger > the item under the finger, if any. > > I continue to believe that long-click almost never makes sense when > using a pointing device, though. :) We are talking about shortcuts for physical keys (e.g. keyboard, the 3 or 4 buttons you'd have on a phone). Aleix
Re: Long press global shortcuts
On 1/12/20 10:11 AM, Aleix Pol wrote: 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? It might depend on what action the long-press is going to trigger. For long-press to show a mobile-friendly grid-based context menu, it might be nice to be able to long-press, slide your finger over to the item you want to select, then release it. In this case, the release would trigger the item under the finger, if any. I continue to believe that long-click almost never makes sense when using a pointing device, though. :) Nate
Re: Long press global shortcuts
On Sun, Jan 12, 2020 at 5:11 PM Aleix Pol 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?) I don't think we need to change 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? I don't think we can simply change. There are plenty of global shortcuts that rely on key repeat events such as volume or brightness when you typically hold down for continual changes. We can't break them. >Maybe only in the cases where there's a long > press counterpart? I think it would require some way of doing both - that could be either automatically there's a long press event on the same key, or an explicit flag when you register the shortcuts. --- Real question to answer is if it's needed for more things than just the power button and if it needs kglobalaccel UI configuration. If not, it may be easier to just put special case code into kwin as a key filter to call the shutdown UI on long press rather than making fairly huge changes across the API. David
Re: Long press global shortcuts
Hi, I noticed on my phone all buttons (power, volume, home) react only on release. On the desktop I don't know how annoying it would be to react only on press. However, that would also make it consistent with in-application shortcuts, which also trigger on press. Perhaps it's best to only do on release triggers for shortcuts that actually have a long-press trigger? Cheers Kai Uwe
Long press global shortcuts
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