Bug 460169

Summary: Horizontal/rectangle icons don't stretch to fill height on horizontal panel
Product: [Plasma] plasmashell Reporter: ratijas <me>
Component: Application Launcher (Kickoff) widgetAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: christian+kde, denysmb112007, mikel5764, nate, niccolo.venerandi, noahadvs
Priority: NOR Keywords: regression
Version First Reported In: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Kickoff custom icon - square (regressed)
Kickoff custom icon - wide (how it should be)
Simple patch that made that second screenshot possible
small kickoff icon v5.26.5
large kickoff icon v5.27.0
screenshot with wider than tall icon
wider than tall icon

Description ratijas 2022-10-09 16:55:24 UTC
Created attachment 152668 [details]
Kickoff custom icon - square (regressed)

SUMMARY

Non-square landscape-oriented custom icons don't stretch to fill the panel height anymore. It's a regression from 5.25 after recent implementation of custom label support that significantly changed sizing code and is not based on an assumption that icons should always be square (width == height).

STEPS TO REPRODUCE
1. Open settings for Application Launcher (Kickoff) applet.
2. Choose some horizontal image as custom icon.
3. Apply.

OBSERVED RESULT
Icon stays square, squeezed to only be as wide as the panel's height.

EXPECTED RESULT
Applet should become as wide as needed to fill the icon vertically. Also, on a vertical panel it should become as tall as needed to fill horizontally. In both cases, applet's minimum size should be a square based on the direction opposite to the panel's form factor (so it doesn't become too thin).

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE: git-master
Qt Version: 5.15.6
Kernel Version: 5.19.13-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 970M/PCIe/SSE2
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: G752VT
System Version: 1.0
Comment 1 ratijas 2022-10-09 16:58:10 UTC
Created attachment 152669 [details]
Kickoff custom icon - wide (how it should be)
Comment 2 ratijas 2022-10-09 16:59:31 UTC
Created attachment 152670 [details]
Simple patch that made that second screenshot possible

Naïve patch, probably misses some general applet's Layout.* parts.
Comment 3 veggero 2022-10-09 18:00:18 UTC
Cannot reproduce in 5.25.5 after setting a very wide png
Comment 4 Bug Janitor Service 2022-10-18 00:51:19 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1212
Comment 5 ratijas 2022-10-25 12:36:25 UTC
Git commit f3cc3ea33f59f627519956225a654cc7f73476e2 by ivan tkachenko.
Committed on 25/10/2022 at 11:55.
Pushed by ratijas into branch 'master'.

applets/kickoff: Reiterate on compact representation sizing code

All 4 min/max width/height expressions were combined into one property
block for deduplication and code locality. Some helper properties were
introduced, others removed as obsolete.

Compact icon now does not shrink to a size less than a panel's orthogonal
direction, such that is stays at least square or taller (in vertical) /
wider (in horizontal form factor).

Extra margins are added to the left and right of the label (if present)
instead of spacing between it and an icon. Otherwise text looks too
sticky to its neighboring widgets IMHO.

Test plan: check with and without icons, text on horizontal, vertical
panels and on a desktop; in every form factor use icons of different
aspect ratio: square, landscape, portrait, and an invalid one (can be
set to a valid, then move the icon file and restart plasmashell).

M  +58   -59   applets/kickoff/package/contents/ui/Kickoff.qml
M  +0    -14   applets/kickoff/package/contents/ui/code/tools.js

https://invent.kde.org/plasma/plasma-desktop/commit/f3cc3ea33f59f627519956225a654cc7f73476e2
Comment 6 cs 2023-02-21 16:36:09 UTC Comment hidden (spam)
Comment 7 cs 2023-02-21 16:37:38 UTC Comment hidden (spam)
Comment 8 cs 2023-02-21 16:38:03 UTC Comment hidden (spam)
Comment 9 Nate Graham 2023-02-21 20:51:07 UTC Comment hidden (spam)
Comment 10 cs 2023-02-22 10:24:07 UTC
(In reply to Nate Graham from comment #9)
> Christian, that seems like a slightly different issue, and I'm afraid I can
> confirm that it's intentional now.

Why do you think it's different? What is intended with this fix, is what I'm experiencing now: stretch the icon to fill out the available space. Only difference is, the direction, horizontally or vertically, but I would expect the behaviour to be direction agnostic except explicitly made different. Haven't looked at it so closely, but could be, idk.

I think, it was just overlooked, that the non-stretching behaviour could be valid, too. and IMHO there should both be supported, maybe with an option.
Comment 11 ratijas 2023-02-22 13:32:35 UTC
As a workaround you could make yourself an icon which is wide enough for the panel width, and not so tall.  So that the new code correctly displays it as a rectangle.

But I have to agree, no one thought of extra-wide vertical panels usecase. I see two problems with vertical panels in general:

1. they are often too thin to fit anything. See user switching applet.
2. they are sometimes too wide to handle all the width you give them. like in your case.
Comment 12 cs 2023-02-22 21:16:35 UTC
(In reply to ratijas from comment #11)
> As a workaround you could make yourself an icon which is wide enough for the
> panel width, and not so tall.  So that the new code correctly displays it as
> a rectangle.
> 
> But I have to agree, no one thought of extra-wide vertical panels usecase. I
> see two problems with vertical panels in general:
> 
> 1. they are often too thin to fit anything. See user switching applet.
> 2. they are sometimes too wide to handle all the width you give them. like
> in your case.

Yeah, thougt about s.th. like you probosed, but that's quite a hack.

I must say, I have used this layout since several years, somewhen since early plasma 4 days. So I can't say, that vertical panels are problematic.
Sure, I haven't used all applets in my panel, but those I have used have worked quite well until now, but I guess, there are also applets that don't work too well in a horizontal panel, because they are not intended to be used in a panel.

What would be about a setting (check box), where you can select yourself, if you want the icon to expand or not?
On the other hand, should all applets that have a icon like this, have this setting? Would lead to code duplication...
What about the panel? Could it have a setting, that says "all my child applets expand" or "...applets don't expand"? Don't know much about qml, so I don't even know if this would be possible.
So, I see that's not straightforward, but I would really hate, if this would "break" after all these years. On the other hand, I'm aware, that this use case is not widespread, but would really like if a solution can be found.
Comment 13 cs 2023-02-23 15:02:13 UTC
Actually, the workaround with the wide and not so tall icon doesn't work.
the space for is still the square, so as high as width.

Attached screenshot and image i used
Comment 14 cs 2023-02-23 15:04:04 UTC
Created attachment 156649 [details]
screenshot with wider than tall icon
Comment 15 cs 2023-02-23 15:04:42 UTC
Created attachment 156650 [details]
wider than tall icon
Comment 16 cs 2023-03-10 11:16:34 UTC
So, I'm out of luck here?
Comment 17 Nate Graham 2023-03-10 16:19:54 UTC
cs, your issue is something else. It's a combination of two things:
1. Your panel icon is too small because the panel icon size has been set to a very low size in the Icons KCM in the past.
2. We made panel icons remain square even for very thick vertical panels, which was intentional and tracked by Bug 466566.

You can remove the panel icon size from your ~/.configkdeglobals file to make the icon itself fit in the box for it at that thick panel size.
Comment 18 cs 2023-03-11 13:35:40 UTC
Hm, sorry, I don't know what you recommend me to do:
1) I can't find anything in KCM regarding panel icon size
2) I can't find anything in ~/.config/kdeglobals regarding panel icon size
3) AFAIK, panel configuration is in ~/.config/plasma-org.kde.plasma.desktop-appletsrc, so I checked there, too, but couldn't find there anything relading to panel icon size, too
4) I couldn't find documentation for the entries in these config files. 
Could you please elaborate, what I need to change? Or do you have some reference to a documentation, where I can look this up myself?

And actually, my problem isn't that the icon is too small, it's too big (high/tall).
BR, cs
Comment 19 Nate Graham 2023-03-13 15:09:18 UTC
Look in your ~/.kdeglobals file for a group named [PanelIcons]. Delete that line and the line below it.

If that file has no such lines in it, try looking in /etc/xdg/kdeglobals, if it exists.
Comment 20 cs 2023-03-13 15:13:47 UTC
(In reply to Nate Graham from comment #19)
> Look in your ~/.kdeglobals file for a group named [PanelIcons]. Delete that
> line and the line below it.
> 
> If that file has no such lines in it, try looking in /etc/xdg/kdeglobals, if
> it exists.

~/.config/kdeglobals doesn't contain [PanelIcons] group
/etc/xdg/kdeglobals doesn't exist at all
Comment 21 Nate Graham 2023-03-14 13:45:53 UTC
Not sure how to troubleshooing further, sorry. Regardless, your issue is something other than the one originally described here, so let's not keep using this bug report for it. :)