improvements for global shortcuts
ClosedPublic

Authored by trmdi on Feb 4 2019, 7:59 AM.

Details

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.Feb 4 2019, 7:59 AM
Restricted Application added a project: Plasma. · View Herald TranscriptFeb 4 2019, 7:59 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
trmdi requested review of this revision.Feb 4 2019, 7:59 AM

@trmdi can you confirm me the following for your code ?

  1. When a layout is loaded for first time then "global shortcuts based on position" are applied based on Latte set priority for which view to be forwarded
  2. When the user changed the isPreferredForShortcuts for first time afterwards [1] is never used again EXCEPT if the user set the property
preferredForShortcutsTouched=false

on its own

Is this what you wanted to achieve?

Note: this is important, the preferredForShortcutsTouched property must be moved from universalsettings to layout

app/settings/universalsettings.h
51 ↗(On Diff #50814)

this needs to be part of layout.h because it should be set at per layout level if it is set at universalsettings then many things could break when the user switches layouts or uses MultipleLayouts

trmdi added a comment.EditedFeb 4 2019, 1:23 PM

@trmdi can you confirm me the following for your code ?

  1. When a layout is loaded for first time then "global shortcuts based on position" are applied based on Latte set priority for which view to be forwarded
  2. When the user changed the isPreferredForShortcuts for first time afterwards [1] is never used again EXCEPT if the user set the property ` preferredForShortcutsTouched=false `

    on its own

Is this what you wanted to achieve?

Note: this is important, the preferredForShortcutsTouched property must be moved from universalsettings to layout

My code works like this:

1, if the user has never touched the Behavior > Activate... checkbox, Latte would automatically find the best view. (Not only the first time)
Yes, this should be moved to the layout class.

2, once he touched it, latte would remember that, and follow his setting.

What do you think?

What do you think?

it looks and behave nice, lets see with Layout how it will look but I believe there will be no issues,
we are ok to commit if the property is moved to Layout

trmdi updated this revision to Diff 50974.Feb 5 2019, 5:50 PM
trmdi added a comment.EditedFeb 5 2019, 6:05 PM

it looks and behave nice, lets see with Layout how it will look but I believe there will be no issues,
we are ok to commit if the property is moved to Layout

I've moved it to Layout, and add a small improvement to the "Behavior> Activate based on position... " checkbox's checked value.
Please test it and improve it if needed.

trmdi updated this revision to Diff 50978.Feb 5 2019, 6:25 PM
mvourlakos added inline comments.Feb 5 2019, 7:06 PM
app/shortcuts/globalshortcuts.cpp
810
  1. this can create a crash when there are no views at all shown.

please make a check that sortedViewsList returns count()>0 and if it doesnt it can return a nullptr

  1. the function highestPriorityView probably needs to be moved at layout and sortedViewsList at the same time but that can be a different commit after this commit has landed because the sortedViewList is used I think in more places at globalshortcuts
trmdi updated this revision to Diff 51015.Feb 6 2019, 2:20 AM
trmdi marked an inline comment as done.Feb 6 2019, 5:29 AM

1, please make a check that sortedViewsList returns count()>0 and if it doesnt it can return a nullptr
-> done

2, your turn

mvourlakos accepted this revision.Feb 6 2019, 6:34 AM

@trmdi would you like to commit it for you?
Can I use your fullname shown at: https://phabricator.kde.org/p/trmdi/ ?
and what is your email?

This revision is now accepted and ready to land.Feb 6 2019, 6:34 AM
trmdi added a comment.Feb 6 2019, 6:44 AM

@trmdi would you like to commit it for you?
Can I use your fullname shown at: https://phabricator.kde.org/p/trmdi/ ?
and what is your email?

Yes, I don't have the commit permission.
Yes, that name, trmdi@yandex.com.

Thank you! :)

This revision was automatically updated to reflect the committed changes.