[Task Manager] Activate tasks by Meta + number shortcuts
AbandonedPublic

Authored by broulik on Sep 6 2016, 1:40 PM.

Details

Reviewers
hein
Group Reviewers
Plasma: Design
Plasma
Summary

This is a rather often requested functionality but in Plasma this is much trickier as we could have multiple task bars.

Pressing Meta + Number will behave like clicking the respective task bar entry, ie. you can launch pinned applications with it, minimize and unminimize, as well as open the popup for grouped tasks in which you can then use the arrow keys and Return to select a window.

Only one task manager applet can have the option enabled. If the user has more than one task manager applet, the configuration dialog will indicate this fact (simply be default, you know) and activating the option will disable it for the other applet. The functionality can also be disabled by unchecking it for the applet which has it currently enabled.

Test Plan

The option is enabled by default, so on startup the first task bar that is created will have this (hence the enum crap instead of a simple bool).

I think KWin at least occupies Meta+0 for it, so that cannot be assigned by default. (Forgot whether the others wee pre-occupied).

When checking the option in an applet while another one already has it, it will be unchecked for the other applet. If you uncheck it, the functionality will be disabled

Config dialog

When there are multiple applets present (wording/visuals could be improved)

Global shortcuts config

Diff Detail

Repository
R119 Plasma Desktop
Lint
Lint Skipped
Unit
Unit Tests Skipped
broulik updated this revision to Diff 6482.Sep 6 2016, 1:40 PM
broulik retitled this revision from to [Task Manager] Activate tasks by Meta + number shortcuts.
broulik updated this object.
broulik edited the test plan for this revision. (Show Details)
broulik added reviewers: Plasma, Plasma: Design, hein.
broulik set the repository for this revision to R119 Plasma Desktop.
Restricted Application added a project: Plasma. · View Herald TranscriptSep 6 2016, 1:40 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik updated this object.Sep 6 2016, 1:41 PM
broulik edited the test plan for this revision. (Show Details)
broulik updated this object.Sep 6 2016, 1:44 PM
mart added a subscriber: mart.Sep 6 2016, 1:56 PM

the owner doesn't seem to be saved and restored anywhere, so it may happen that is not deterministic who owns it? (not sure if needed tough)
(btw, if one had an Applet subclass implementation, there is a globalConfig() kconfiggroup thatsaves and reads in an area of appletsrc common for all applets of a given tye

A question: what would happen if a user has existing shortcuts defined already? (I know that's a non-default case)

the owner doesn't seem to be saved and restored anywhere, so it may happen that is not deterministic who owns it? (not sure if needed tough)

In Component.onCompleted it sets itself as owner if its config says the feature is Enabled

btw, if one had an Applet subclass implementation, there is a globalConfig() kconfiggroup thatsaves and reads in an area of appletsrc common for all applets of a given tye

Neat. There I could just store the ID and then we also avoid two applets claiming to be the owner (should not happen but who knows)

what would happen if a user has existing shortcuts defined already?

They won't be re-assigned, ie. if Meta+1 is already something else, it will stay that way. But you can end up with a bit of a mixture of, for example, only Meta+4, Meta+5, Meta+6 being assigned to task manager if the others were occupied.

mart added a comment.Sep 6 2016, 2:05 PM

A question: what would happen if a user has existing shortcuts defined already? (I know that's a non-default case)

afaik then the corresponding shortcuts from the taskbar should be disabled by default

graesslin added inline comments.
applets/taskmanager/CMakeLists.txt
35

Do we really need KActionCollection? At least in KWin I ported away from it, because I don't want the xmlgui dependency. Overall KActionCollection is just doing some convenience stuff which is not really needed.

Do we really need KActionCollection? At least in KWin I ported away from it, because I don't want the xmlgui dependency.

Isn't needed at all from what I can tell. I could just set the component name property manually and call it a day.

Do we really need KActionCollection? At least in KWin I ported away from it, because I don't want the xmlgui dependency.

Isn't needed at all from what I can tell. I could just set the component name property manually and call it a day.

yeah, cool!

broulik updated this revision to Diff 6491.Sep 6 2016, 3:41 PM

Get rid of KActionCollection to drop KXmlGui dependency

hein edited edge metadata.EditedSep 6 2016, 6:06 PM

I'm kind of wondering about the arch here ... I can see that this works, but is it worth putting complexity like evaluating taskManagerAppletsCount into the QML code, along with all of this register/unregister applet stuff? I feel like this could all be on the C++ side and driven by the constructors+destructors of the Backend class, keeping a static instance counter in there. It would cut down on the boilerplate and avoid exposing the nitty-gritty to the QML code unnecessarily.

mart added a comment.Sep 7 2016, 10:08 AM
In D2680#49986, @hein wrote:

I feel like this could all be on the C++ side and driven by the constructors+destructors of the Backend class, keeping a static instance counter in there. It would cut down on the boilerplate and avoid exposing the nitty-gritty to the QML code unnecessarily.

I tend to agree here

ivan added a subscriber: ivan.Sep 7 2016, 10:16 AM

Has the alternative of having a shortcut that shows up small 'hints' on the tasks - number or letter that should be pressed in order to activate the task been considered?

Like Konqueror and KMail had with the 'ctrl'?

Along the lines of https://www.qutebrowser.org/doc/img/hints.png

This would be more scalable than actually registering all these shortcuts.

Has the alternative of having a shortcut that shows up small 'hints' on the tasks - number or letter that should be pressed in order to activate the task been considered?

I thought about, say, longpress Meta and it shows up the numbers but I have no clue how/if this could be implemented. You still need to register all of the shortcuts, though, iirc.

ivan added a comment.Sep 7 2016, 10:38 AM

I meant more of a single shortcut 'Meta+PlasmaKey' which focusses on plasma and shows the overlays. No further shortcuts needed.

And this would be possible to generalize later to access systray applets, etc.

colomar added a subscriber: colomar.Sep 8 2016, 2:51 PM
In D2680#50099, @ivan wrote:

I meant more of a single shortcut 'Meta+PlasmaKey' which focusses on plasma and shows the overlays. No further shortcuts needed.

And this would be possible to generalize later to access systray applets, etc.

I would actually go one step further: Don't have a single "Plasma shortcut", but just use the existing feature that one can assign a shortcut to an applet, assigning a shortcut to the task manager in our default config(s) (and also one for the systray if we want to make it possible there as well) and when that is pressed, show an overlay with the assigned numers.

Yes, it would mean that switching to a task would take one more key press, but

  • It would do away with all the conflicts with multiple task managers
  • It would not need any addition config UI
  • It would occupy only one shortcut per Plasmoid (so 1 to 2 as I see it now)
mart added a comment.Oct 6 2016, 9:07 AM

any news on that?

cfeck added a subscriber: cfeck.EditedNov 12 2016, 2:33 PM

monthly ping: What is the status of this? Any unresolved issues?

What is the status of this?

Dunno, somewhat lost motivation, frankly. Imho we need Meta+number, as that's what virtually any other desktop has and what anybody keeps complaining about.

While Meta+some-other-shortcut and then pressing 1 would work for multi-screen (assign a different shortcut per task manager) and I somewhat like that idea – it's much easier to implement on a technical level, at least if you don't go crazy with "plasma overlay that has everything in it" – that's not something I would use if I had to press two distinct keyboard shortcuts.

So, dunno how I should proceed.

My suggestion would be to make meta+number only work for the first task manager on the primary screen. Similar to how we do it with the meta only activation. It only triggers for the first launcher it finds. Yes, it would not support the full flexibility, but we also don't have to support the full flexibility. Sometimes we can go and offer a feature which works for > 90 % of the users and ignore the super-customizers.

hein added a comment.Nov 14 2016, 5:09 PM

As maintainer: I agree with graesslin.

How would I tell the "primary monitor task manager" applet?

We could do the same hack we have with Kickoff, where the first task manager it finds with a global shortcut will be invoked. But that's not really discoverable how to change/why it broke when you created a new panel manually, etc etc.

Ping

How would I tell the "primary monitor task manager" applet?

I would go with following heuristic:

  1. Identify primary screen
  2. Iterate over all panels by ids
  3. Check whether there is a task manager
  4. if there is a panel bingo
  5. if not go to next screen, till we find a task manager