Long press global shortcuts

David Edmundson david at davidedmundson.co.uk
Mon Jan 13 10:29:24 GMT 2020


On Sun, Jan 12, 2020 at 5: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?)
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


More information about the Plasma-devel mailing list