When closing several apps from the task manager with the mouse
middle button, it is convenient that the remaining tasks are not
resized so that you don't need to move your mouse to target the
next app you intend to close. The tasks will be resized when the
mouse is moved out of the task manager.
This mimics the behavior of tabs in Firefox or Chrome.
Details
- Reviewers
hein - Group Reviewers
Plasma VDG - Commits
- R119:2861ae7cc675: [Task Manager] When closing apps, resize only when mouse is out.
With the task manager configured without grouping, open several
applications so that the tasks displayed in the task manager get
smaller to fit in the available space. Now close the last three
for example: you should be able to do so without having to move
your mouse.
Diff Detail
- Repository
- R119 Plasma Desktop
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
I like the idea. The Firefox implementation is smart enough not to do it when a tab is closed by means other than direct user mouse interaction though.
I think it needs to be made a bit more robust still. For one it's not called requestClose() without reason: Not all windows are closable / will be closed upon this request. It might also race with a different window closing going on in parallel. taskClosedWithMouseMiddleButton needs to be invalidated on exit, and the middle-click close and onItemRemoved probably need to compare persistent model indexes or window ids (easier) to check it's the same.
Improvements as per @hein comments
Keep resizing if the task being closed with the middle button is
the last one in the task manager. That matches Firefox behavior.
Thanks again for the fast reviews.
applets/taskmanager/package/contents/ui/Task.qml | ||
---|---|---|
156 | Getting close, but pid is not reliable. It's not available for all tasks (e.g. remote X11 clients). You need to use the window id role instead. |
applets/taskmanager/package/contents/ui/Task.qml | ||
---|---|---|
156 | I do not find a window id role, maybe I am not looking in the right place. Could you please provide so more guidance ? |
Hi @hein, could you help me finish this patch ? Can you have a look at my previous question ? Many thanks in advance.
Almost! This is not going to work reliably for groups, because the order in which their children are deleted is up to the client processes. That means once a group goes from two to one and morphs into a regular task item, the window id it has might not match the winIdList[0] you previously recorded. Instead, you should store the entire winIdList, and when an item is removed check whether it's winIdList[0] is in the list you saved away. You also need to do a bounds check before you access [0] though because not every task has a window id (e.g. launchers and startup notifications), so you're causing errors ATM.
Thank you so much for your patient reviews!
As a side note, I noticed something a bit odd while testing: if the task manager is configured with grouping, and you open a bunch of Kate instances and close them all at once by middle-clicking on the "grouped task", then it takes more and more time for each instance of Kate to close. Closing 9 instances of Kate, the last one is closing about 7 seconds after the 8th... Can you reproduce that ? I don't think it is a task manager issue, though, as I cannot reproduce that with other applications.