Display shortcut badges while holding Super
ClosedPublic

Authored by trmdi on Jan 30 2019, 5:29 PM.

Details

Summary

Use KModifierKeyInfo to display shortcut badges while holding Super

BUG: 401768

Test Plan

Just playing with it.
I still don't understand the GlobalShortcut class very well, correct me if I make any mistake.

Diff Detail

Repository
R878 Latte Dock
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
trmdi created this revision.Jan 30 2019, 5:29 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJan 30 2019, 5:29 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
trmdi requested review of this revision.Jan 30 2019, 5:29 PM
mvourlakos requested changes to this revision.Jan 30 2019, 5:47 PM
mvourlakos added inline comments.
app/CMakeLists.txt
57

please add the new framework to README file also

This revision now requires changes to proceed.Jan 30 2019, 5:47 PM

@trmdi

  1. does it work? any issues?
  2. under wayland did you have any success?
trmdi added a comment.EditedJan 30 2019, 5:52 PM

@trmdi

  1. does it work? any issues?
  2. under wayland did you have any success?
  1. It works without any issue with my use case. Not sure other cases. Can you test it ?
  2. No, because KModifierKeyInfo does not work under wayland: https://bugs.kde.org/show_bug.cgi?id=370454

But I guess when it supports wayland, Latte will do too.

trmdi updated this revision to Diff 50569.Jan 30 2019, 5:55 PM
mvourlakos added inline comments.Jan 30 2019, 6:06 PM
app/globalshortcuts.cpp
283

shouldnt this be valid for Key_Super_R also?

mvourlakos added inline comments.Jan 30 2019, 6:15 PM
app/globalshortcuts.cpp
278

I think a lower interval may be better e.g. 500ms

trmdi updated this revision to Diff 50574.Jan 30 2019, 6:22 PM
trmdi marked an inline comment as done.
trmdi retitled this revision from Display shortcut badges while holding Super_L to Display shortcut badges while holding Super.
trmdi edited the summary of this revision. (Show Details)
mvourlakos accepted this revision.Jan 31 2019, 4:40 PM

@trmdi this is ok, you can merge it and afterwards we can discuss how the Meta behavior should be enabled/disabled/adjusted...

Meta is also used for showing Application Launcher so the two functionalities could be messed up together.

any ideas?

Take note that with latest commits in Latte git version, now Latte shows also the ShortcutBadges from plasma shortcuts for applets
that would probably mean that more Latte Views should be shown if their applets have plasma shortcuts assigned

This revision is now accepted and ready to land.Jan 31 2019, 4:40 PM
trmdi marked 2 inline comments as done.EditedJan 31 2019, 5:18 PM

@trmdi this is ok, you can merge it and afterwards we can discuss how the Meta behavior should be enabled/disabled/adjusted...
Meta is also used for showing Application Launcher so the two functionalities could be messed up together.
any ideas?

I've been thinking about the Meta behavior. Some ideas:

  • When the holding action is detected: just show Latte views with badges and do not activate the App Launcher if users release the Meta key. App Launcher can be activated ONLY IF the holding action is not detected
  • Only show Latte views with badges if: press "Meta+`" (for the wayland case, or users don't want to wait to see the badges) or holding Meta is detected.

(Currently, if I press a shortcut to activate an item, it will show the badges -> not needed)

  • Timeout for determining it's a holding action or not should be 1-2s

This patch is just a draft, so you should improve it before merging by yourself.

I've been thinking about the Meta behavior. Some ideas:

  • When the holding action is detected: just show Latte views with badges and do not activate the App Launcher if users release the Meta key. App Launcher can be activated ONLY IF the holding action is not detected
  • Only show Latte views with badges if: press "Meta+`" (for the wayland case, or users don't want to wait to see the badges) or holding Meta is detected.

sounds ok

(Currently, if I press a shortcut to activate an item, it will show the badges -> not needed)

  • Timeout for determining it's a holding action or not should be 1-2s

it is too low I will play with it

This patch is just a draft, so you should improve it before merging by yourself.

  1. I will probably merge it and afterwards I will fix the issues e.g. if any other modifier is pressed when the Meta timer ends then the ShowDocks action shouldnt be trigerred but the timer should be restarted.
  1. That means that the globalshortcuts class will be adjusted in order to track the modifiers that are pressed, Super, Shift, Ctrl and Alt, I dont know if there are any more...
  1. Afterwards the hack that is relevant to X11 and was copy pasted from Plasma Activites Explorer in order to track when Meta is released is not needed any more and the new infrastructure will be used.

We will play with this with iterations and through kde bugs tracker in order to fix any issues
There is also a chance that the user will be able to enable/disable that behavior from Latte Preferences in case some users hit corner cases that break their workflows.

it is too low I will play with it

sorry I meant too high, I would prefer a value between 500ms-800ms

This revision was automatically updated to reflect the committed changes.

@trmdi can you please test latest master for global shortcuts?

features supported are the following:

  1. the Meta pressed case
  2. applets can show their Plasma shortcuts at their Shortcut Badges
  3. When showViews is trigerred only latte views that have shortcuts are shown if they are hidden and for all of them independent of their number, all badges are shown at all views (previously only shortcut badges for maximum two views could be shown)
trmdi added a comment.Feb 3 2019, 2:42 AM

@trmdi can you please test latest master for global shortcuts?

No problem, I'm testing it, I'll give you feedback if I find anything.