applets/taskmanager: more sensible default horizontal item width
There are 3 changes here:
-
When using inline grouping (grouping with "Combine into single button" turned off), items are inexplicably much narrower. This was done in https://phabricator.kde.org/D1882 to match the behavior of an old task manager applet fork (the "EITM" mentioned in D1882), presumably to make it easier for people to move back to the builtin applet.
This behavior is surprising. There is no indication that using inline grouping would change anything about the width of tasks items, so the two should not be tied together. The other two changes make this unnecessary as well.
before this MR using inline grouping before this MR not using inline grouping I documented this behavior in https://bugs.kde.org/show_bug.cgi?id=489375.
This MR removes this special case.
-
The default width of tasks now get smaller as the (horizontal) panel gets taller. A tall horizontal panel has less horizontal space than one that is lower in height, because of square items like pinned tasks, Kicker, and the system tray. Previously, the default width ("preferredMaxWidth") gets larger as the panel gets taller. In a 46px panel, one task would already take up about 1/5 of the width of a 1080p monitor at 100% scaling, while at 20px it would barely have enough space to show System Settings's default window title "Quick Settings — System Settings" without ellipsis. Simply reducing the linear factor further would therefore be unreasonable.
This MR adds a small algorithm such that the width actually gets smaller as the panel gets taller.
before (46px) after (46px) before (20px) after (20px) (no difference) The algorithm (plus the next change) is:
let baseFactor = 1 // sane default in case something goes wrong if (tasks.plasmoid.configuration.itemMaxWidth === 0) { baseFactor = 1.2 // narrow } else if (tasks.plasmoid.configuration.itemMaxWidth === 1) { baseFactor = 1.6 // medium } else if (tasks.plasmoid.configuration.itemMaxWidth === 2) { baseFactor = 2 // wide } // This is necessary, otherwise icons would be inappropately scaled down // when using multiple rows let laneHeight = tasks.height / maxStripes() let adjustFactor = Math.max(1, baseFactor - (laneHeight - 20) * 0.01) return Math.floor(preferredMinWidth() * adjustFactor);
-
As there appears to be people who prefer to ensure titles are not cut off, as well as people who prefer less whitespace in task items, I also added an option to configure the default task item width, with three settings: narrow, medium, and wide.
Narrow Medium Wide This is the change I'm the least sure in. If it either should be its own MR or should be dropped, I'll do so.
FEATURE: 489375 FIXED-IN: 6.2.0