Bug 467385

Summary: Non-space-filling panel widgets have unbounded length values and can cause the panel contents to overflow
Product: [Plasma] plasmashell Reporter: Vojtěch Bartoň <gamingforyou875>
Component: PanelAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: mitrax, natalie_clarius, nate, niccolo.venerandi
Priority: NOR    
Version: 5.27.2   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screenshot 1

Description Vojtěch Bartoň 2023-03-15 08:48:12 UTC
Created attachment 157291 [details]
Screenshot 1

SUMMARY
Ever since updating to Plasma 5.27, after opening way too many apps, the (Icons-only) Task Manager will push other applets (ex. Application Menu, see Screenshot 1) off-screen. This could be resolved by using the "Fill panel empty space" option in its settings, but that makes the Task Manager not properly centered (between two spacers).


STEPS TO REPRODUCE
1. Create a panel
2. Add the Icons-Only Task Manager and some applets after it
3. In Task Manager settings, uncheck the "Fill panel empty space" (4th option in Appearance>General)
4. Open a buttload of programs

OBSERVED RESULT
Icons always stay the same height and after too many apps are opened, push other applets off-screen.

EXPECTED RESULT
Use old behaviour - squish icons to make them all fit.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 37
(available in About System)
KDE Plasma Version: 5.27.2
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
This happens on both vertical and horizonzal panels.
Comment 1 Nate Graham 2023-03-15 17:48:09 UTC
In fact using the "fill empty space" option is the only thing that can fix it right now. Without that option being used, the Task Manager widget's length is unbounded and it's up to you to manage this.

This seems like a fairly glaring oversight, but in fact it would be surprisingly challenging to fix: one approach would be to let widgets to be able to know the size of the panel they live in so they could calculate a practical maximum width for themselves, but this is currently is not the case and we don't want to do this because it would break widgets' encapsulation. What we'd have to do is make the panel itself refuse to allow non-space-filling widgets to have more than a certain height/width by capping their width to the value of to [total panel length - combined length of all other widgets]. But this should only be applied to non-space-filling widgets; most don't need such treatment. So we would also need to implement a way for widgets to communicate to the panel they live on to essentially say, "hey please cap my maximum length for me because I don't do it myself kthx".

FWIW...

> but that makes the Task Manager not properly centered (between two spacers).
This is a bug; it's supposed to center itself properly between the two spacers. Can you submit another bug report about that so we can investigate and fix it and then you don't have to use a workaround that breaks other things?
Comment 2 Vojtěch Bartoň 2023-03-15 19:59:35 UTC
(In reply to Nate Graham from comment #1)
> In fact using the "fill empty space" option is the only thing that can fix
> it right now. Without that option being used, the Task Manager widget's
> length is unbounded and it's up to you to manage this.
> 
> This seems like a fairly glaring oversight, but in fact it would be
> surprisingly challenging to fix: one approach would be to let widgets to be
> able to know the size of the panel they live in so they could calculate a
> practical maximum width for themselves, but this is currently is not the
> case and we don't want to do this because it would break widgets'
> encapsulation. What we'd have to do is make the panel itself refuse to allow
> non-space-filling widgets to have more than a certain height/width by
> capping their width to the value of to [total panel length - combined length
> of all other widgets]. But this should only be applied to non-space-filling
> widgets; most don't need such treatment. So we would also need to implement
> a way for widgets to communicate to the panel they live on to essentially
> say, "hey please cap my maximum length for me because I don't do it myself
> kthx".
> 
> FWIW...
> 
> > but that makes the Task Manager not properly centered (between two spacers).
> This is a bug; it's supposed to center itself properly between the two
> spacers. Can you submit another bug report about that so we can investigate
> and fix it and then you don't have to use a workaround that breaks other
> things?

Thanks for the explanation, submitted a new bug :).
https://bugs.kde.org/show_bug.cgi?id=467416
Comment 3 Nate Graham 2023-04-11 21:55:48 UTC
*** Bug 460981 has been marked as a duplicate of this bug. ***
Comment 4 Nate Graham 2023-09-21 22:01:01 UTC
*** Bug 473420 has been marked as a duplicate of this bug. ***
Comment 5 Marco Martin 2023-10-20 10:51:56 UTC
Git commit d13337024946c597563956fe04ed82aee37bcb0c by Marco Martin.
Committed on 20/10/2023 at 12:51.
Pushed by mart into branch 'master'.

Still shrink applets when are not "fill available panel width"

The applet container is always fillWidth/height, this is necessary for
the layout to shrink the applet when needed. to make them not to expand
too much, set a maximumWidth instead

M  +34   -9    containments/panel/contents/ui/main.qml

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