Bug 489375

Summary: Excessive width when not using Inline Grouping
Product: [Plasma] plasmashell Reporter: Kisaragi Hiu <mail>
Component: Task Manager and Icons-Only Task Manager widgetsAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: nate, qydwhotmail
Priority: NOR    
Version First Reported In: 6.1.0   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 6.2.0
Sentry Crash Report:
Attachments: Excessive width by default (panel height 46px)
Under inline grouping mode, the width goes to a more sensible size

Description Kisaragi Hiu 2024-06-28 13:34:30 UTC
Created attachment 171131 [details]
Excessive width by default (panel height 46px)

SUMMARY
The default width of tasks in non-icons-only mode is way too wide when not using Inline Grouping.

STEPS TO REPRODUCE
1. Use the non-icons-only task manager in a horizontal panel. The panel 
2. Turn off Grouping in Behavior settings. Or turn on grouping and turn on "Combine into single button".
3. Open, say, Konsole and close other windows
4. Notice the one task can be double the size of its label
5. Turn on grouping and turn off "combine into single button" (Inline Grouping mode)
6. Notice the width is a lot more sensible now

OBSERVED RESULT
Excessive width for text labels when not using inline grouping.

EXPECTED RESULT
A more sensible width for text labels at all times.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux (6.6.35-2-lts)
KDE Plasma Version: 6.1.0
KDE Frameworks Version: 6.3.0 
Qt Version: 6.7.2

ADDITIONAL INFORMATION

The Inline Grouping mode was added in https://phabricator.kde.org/D1881 and https://phabricator.kde.org/D1882.

This behavior is caused by (a) task items (plasma-desktop/applets/taskmanager/[...]/ui/Task.qml) using the max width for items, and (b) the max width being 1.6x the min width when not using inline grouping. In ui/code/layoutmetrics.js, commented for context:

    function preferredMaxWidth() {
        if (tasks.iconsOnly) {/* ... */}
    
        // Not icons only & using inline grouping
        if (tasks.plasmoid.configuration.groupingStrategy != 0 && !tasks.plasmoid.configuration.groupPopups && !tasks.iconsOnly) {
            return preferredMinWidth();
        }
    
        // default case, which is why too wide
        return Math.floor(preferredMinWidth() * 1.6);
    }
Comment 1 Kisaragi Hiu 2024-06-28 13:35:13 UTC
Created attachment 171132 [details]
Under inline grouping mode, the width goes to a more sensible size
Comment 2 Kisaragi Hiu 2024-06-28 14:12:46 UTC
Additional "additional info": The 1.6x was reduced from 1.8x in https://invent.kde.org/plasma/plasma-desktop/-/commit/f34cf61260ab02dfda4da0cb1368d853df306246, citing https://bugs.kde.org/show_bug.cgi?id=351425 and https://bugs.kde.org/show_bug.cgi?id=353337.

The 1.8x was already there when the QML task manager was first added: https://invent.kde.org/unmaintained/kde-workspace/-/commit/6255b2b7b5717c9d7066a493b3efda8761a886da#36bbdfc2e487070cc0f9fc9cdd4fca276e290a93_0_89

I do not understand why Inline Grouping should have a different width. Inline Grouping, as far as I understand, just makes it so that windows of the same app stays side by side and get dragged together.
Comment 3 Nate Graham 2024-07-02 23:34:03 UTC
Don't these shrink as more windows are opened?

In your example, it on;t looks excessive because that Konsole window doesn't have a long window title. But that's not an assumption we can make.

The entire point of the icons-and-text Task Manager is to show text; the more of it we elide, the less of an advantage it has over the IOTM for people who want to see text.
Comment 4 Nate Graham 2024-07-02 23:34:57 UTC
Regardless, in progress with https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2351.
Comment 5 Kisaragi Hiu 2024-07-10 03:13:34 UTC
Git commit e78d3a39bcf5e1bc5f6b166cd4a2d4200ffdb5d4 by Kisaragi Hiu.
Committed on 10/07/2024 at 02:13.
Pushed by moonlight into branch 'master'.

applets/taskmanager: remove inline grouping width special case

There is no indication that using inline grouping (grouping as multiple
buttons, with "Combine as single button" turned off) would change
anything about the width of tasks items, so it should not be tied
together.

The special cased max width is also too small, with eg. the label for
the default page in System Settings already clipping.

The special case was added as part of https://phabricator.kde.org/D1882
just to match the behavior of Netrunner's Expanding Icons Task Manager
fork from back then, which the feature was a port of.
FIXED-IN: 6.2.0

M  +0    -4    applets/taskmanager/package/contents/ui/code/layoutmetrics.js

https://invent.kde.org/plasma/plasma-desktop/-/commit/e78d3a39bcf5e1bc5f6b166cd4a2d4200ffdb5d4