Bug 474083 - Lock/Logout icon size changes when only one action is visible
Summary: Lock/Logout icon size changes when only one action is visible
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Lock/logout (show other bugs)
Version: master
Platform: Arch Linux Linux
: NOR minor
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
: 370640 467564 468475 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-09-03 08:48 UTC by Yannick Bruneau
Modified: 2023-09-18 17:28 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0
Sentry Crash Report:


Attachments
5 widgets side-by-side, the first has 3 actions, and the 4 others have each 1 action. (2.52 KB, image/png)
2023-09-03 08:48 UTC, Yannick Bruneau
Details
attachment-796518-0.html (2.17 KB, text/html)
2023-09-07 02:36 UTC, Yannick Bruneau
Details
attachment-879328-0.html (2.54 KB, text/html)
2023-09-07 22:03 UTC, Yannick Bruneau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yannick Bruneau 2023-09-03 08:48:13 UTC
Created attachment 161358 [details]
5 widgets side-by-side, the first has 3 actions, and the 4 others have each 1 action.

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Add a Plasma Panel (optional : place it at the top, and set its height at 24px).
2. In that panel, add the Lock/Logout plasmoid.
3. Go into the Lock/Logout plasmoid settings, and choose only one action (1 box checked only).

OBSERVED RESULT
We can see that the icon size is smaller when there is only 1 action chosen to compare with the size of the icons when there are at least 2 actions chosen.

EXPECTED RESULT
Whether you choose 1 or more actions, the icon(s) size(s) should be the same.
To me the correct size is the one used when there are at least 2 actions chosen.
The fix should be done to context where the user chooses only 1 action.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Arch Linux, but the OS is not the problem
(available in About System)
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.10

ADDITIONAL INFORMATION
My purpose of putting 3 independent lock/logout plasmoids with 1 action each, is to be able to order in the panel each icon/action the way I want, which is not allowed by the widget.
Being able to reorder the actions/icons would be a nice feature.
Comment 1 Yannick Bruneau 2023-09-03 21:45:52 UTC
I've found the issue in the file /usr/share/plasma/plasmoids/org.kde.plasma.lock_logout/contents/ui/lockout.qml.
The solution to fix the issue is to remove the " - 1" to the following lines of code :

#21 : return height < minButtonSize * visibleButtons ? height * visibleButtons : height / visibleButtons - 1;
FIX : return height < minButtonSize * visibleButtons ? height * visibleButtons : height / visibleButtons ;

#28 : return width >= minButtonSize * visibleButtons ? width / visibleButtons - 1 : width * visibleButtons
FIX : return width >= minButtonSize * visibleButtons ? width / visibleButtons : width * visibleButtons

I've only tested the with the top bar with 24px height, and it works fine.
Comment 2 Yannick Bruneau 2023-09-03 22:27:50 UTC
I've just added a "default panel" and it appeared to the left edge of the screen.
I've tested the existing widget and then the one I've fixed, there is no regression, it works the same :
- 1 icon fills the width of the panel
- 2 icons fill the width of the panel but they are aside so their sizes are smaller
- 3 icons or more, each icon fills the width of the panel and is put above/below the others.

Then, I've moved that new panel to the top edge of the screen (the panel is bigger than mine and is above/over it).
I've added the existing widget and the one I've fixed, both work the same, no regression :
- 1 icon fill the the height of the panel
- 2 icons fill the height of the panel, they have smaller icon sizes and 1 icon is above the other.
- 3 icons or more, each icon takes all the height and icons are after/before the others.

So, the fix works for tiny bars.
Comment 3 Nate Graham 2023-09-05 20:26:26 UTC
This looks like a correct fix to me! I wonder why that random -1 was in there to begin with. Would you like to submit a merge request at https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/?
Comment 4 Yannick Bruneau 2023-09-07 02:36:50 UTC
Created attachment 161459 [details]
attachment-796518-0.html

Hi Nate,
I'd looked for it the other day, but I don't how to do it and where at.
I'd found a kde.org webpage where it says where to go whether we need to declare a bug or want to contribute to an existing project  or submit a merge request, etc.
My understanding is that we need to have an account, fins the project then fork the project, and have a git repository, ...All that complexity just to change one file !?So I chose to upload that single file within the bug page to let someone like you or the author to check if the fix is okay and then merge it. I also wonder why the -1 was there and its purpose. Maybe it was useful at sometime as a workaround to a panel bug that might have been fixed in the meantime, and now that -1 is useless and causes a graphical bug in some cases. 
 
  Le mar., sept. 5, 2023 à 22:30, Nate Graham<bugzilla_noreply@kde.org> a écrit:   https://bugs.kde.org/show_bug.cgi?id=474083

Nate Graham <nate@kde.org> changed:

          What    |Removed                    |Added
----------------------------------------------------------------------------
          Severity|normal                      |minor
Comment 5 Nate Graham 2023-09-07 13:37:10 UTC
> All that complexity just to change one file

Yep, that's how software dev works. :) The good news is that it only needs to be done once. But if it seems like too much, I'm happy to do it myself.
Comment 6 Nate Graham 2023-09-07 13:42:09 UTC
Git commit 2ef898810597cf23218029cfcd1cdbef8061e605 by Nate Graham.
Committed on 07/09/2023 at 15:40.
Pushed by ngraham into branch 'master'.

applets/lock_logout: don't unnecessarily reduce height for single items

Co-authored-by: Yannick <yb21com@yahoo.fr>
FIXED-IN: 6.0

M  +2    -2    applets/lock_logout/contents/ui/lockout.qml

https://invent.kde.org/plasma/plasma-workspace/-/commit/2ef898810597cf23218029cfcd1cdbef8061e605
Comment 7 Nate Graham 2023-09-07 13:42:48 UTC
*** Bug 467564 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2023-09-07 13:42:51 UTC
*** Bug 468475 has been marked as a duplicate of this bug. ***
Comment 9 Yannick Bruneau 2023-09-07 22:03:42 UTC
Created attachment 161500 [details]
attachment-879328-0.html

Great ! I'm glad I fixed this issue that was irritating me... and happy I could find it pretty quickly and give a first concrete contribution to the KDE Plasma project.
I'm aware of the tools that exist for devs work, as my job is project/product owner. The projects or products I own strongly rely on IT projects, like were my studies (computer science).
I didn't want to lose time in finding how to do a merge request just for 2 lines of code. Though I know the existence and purpose of tools like Git, I didn't want to take the hassle just for once.
Thank you Nate for the time you spent for initiating the merge request and giving me credit (as co-author). It's very nice !
 
 
  Le jeu., sept. 7, 2023 à 15:42, Nate Graham<bugzilla_noreply@kde.org> a écrit:   https://bugs.kde.org/show_bug.cgi?id=474083

Nate Graham <nate@kde.org> changed:

          What    |Removed                    |Added
----------------------------------------------------------------------------
                CC|                            |adam.m.fontenot+kde@gmail.c
                  |                            |om

--- Comment #8 from Nate Graham <nate@kde.org> ---
*** Bug 468475 has been marked as a duplicate of this bug. ***
Comment 10 Nate Graham 2023-09-08 16:54:10 UTC
You're very welcome!
Comment 11 Nate Graham 2023-09-18 17:28:15 UTC
*** Bug 370640 has been marked as a duplicate of this bug. ***