Bug 327608

Summary: Taskbar always groups similar windows, even when it's not full
Product: [Unmaintained] plasma4 Reporter: Mircea Kitsune <sonichedgehog_hyperblast00>
Component: widget-taskbarAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: dweeble01103, hein, sonichedgehog_hyperblast00
Priority: NOR    
Version: 4.11.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 4.11.3
Sentry Crash Report:
Attachments: showing grouping even though space available (and tray settings)

Description Mircea Kitsune 2013-11-14 13:16:03 UTC
The task manager on the default panel is automatically grouping windows of the same type, even if "Only when taskbar is full" is enabled. For example, if there are no processes with windows open and I start two instances of Dolphin, they are automatically grouped, although there's plenty of space till the taskbar is full even in the slightest.

Reproducible: Always

Steps to Reproduce:
1. Right click the taskbar and select "Task Manager Settings". Make sure that Grouping is set to "By Program Name" and "Only when taskbar is full" is enabled.
2. Make sure you don't have any windowed programs taking up space on the taskbar, and open two applications of the same type (Dolphin is easiest).
Actual Results:  
The windows are instantly grouped.

Expected Results:  
They should only be grouped if the the taskbar is full enough.

This didn't happen in KDE 4.10.5. It might be related to the widget having been re-written in QML.
Comment 1 Eike Hein 2013-11-14 13:18:27 UTC
To be blunt: The calculation of "we're full now" threshold was simply broken as far as 4.11.2 due to a bunch of accidental wrong assumptions and a logic error - it was fixed for 4.11.3, and should now behave correctly. Please re-test with that release, and reopen if you still have problems.
Comment 2 bill p. (aka google01103) 2013-11-14 13:27:10 UTC
I can confirm it does not work properly in 11.3 (at least for me), see attached pic
Comment 3 bill p. (aka google01103) 2013-11-14 13:28:43 UTC
Created attachment 83560 [details]
showing grouping even though space available (and tray settings)
Comment 4 Eike Hein 2013-11-14 13:39:02 UTC
Roughly, the Task Manager is considered full if it needs to start shrinking tasks to fit them. Going by your screenshots I'd guess the calculated threshold is 6 (the preferred maximum width derives partly from the font settings, and in the shot there's probably enough room for three full-width tasks per row).

The problems in <4.11.2 were an off by one, a possible calculation error when "Force Rows" was enabled that resulted in too-low thresholds, and a possible race condition where the threshold wasn't invalidated after an applet size change.

I'm quite confident those bugs are addressed, i.e. what we're left with is a policy decision. I understand that in your screenshot it feels to you like there is room because there's this attractive-looking gap there, but this is somewhat of an edge case (most people don't use multiple rows) and basically orthogonal to what size to use for the "how many tasks fit" decision. Currently the preferred maximum width is used; certainly it could also be the preferred minimum width or any point in the range instead, but the max width is very similar to what the old applet worked with as well.

You could add a special-case behavior like "if we've overflowed into multiple rows already, always use a multiple of the number of tasks we're currently fitting into the first row", but you'd have to put a cap on that for situations with very many tasks, and then further special-case for "Force row settings" (you can have multiple rows even with only two tasks, then). The current algorithm is very KISS.
Comment 5 Mircea Kitsune 2013-11-14 15:08:37 UTC
Thanks for the info, I'll wait for my distribution to update to KDE 4.11.3.