Bug 512489

Summary: Ability to center a widget in the available space, not just in the center of the panel
Product: [Plasma] plasmashell Reporter: LeoHart <leohart>
Component: Panel Spacer widgetAssignee: Plasma Bugs List <plasma-bugs-null>
Status: CONFIRMED ---    
Severity: wishlist CC: kde, kdedev, mvourlakos, nate
Priority: NOR    
Version First Reported In: 6.5.3   
Target Milestone: 1.0   
Platform: CachyOS   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: observation

Description LeoHart 2025-11-22 22:42:41 UTC
Created attachment 187079 [details]
observation

SUMMARY
--------------------------------------
A bug occurs when a flexible spacer is used in combination with the global menu, which is not recognised as a border for the spacer.

STEPS TO REPRODUCE
--------------------------------------
1. Configure a control bar with the widget: Global menu | flexible spacer | Widget | flexible spacer
2. Maximize an application with global menu support.

OBSERVED RESULT
---------------------------------------
If the global menu appears, the widget is not centred within the available free space.
It seems the flexible spacer does not recognise that the global menu fills the space.

EXPECTED RESULT
--------------------------------------
The widget between the flexible spacers should be positioned in the centre of the available free space.

SOFTWARE/OS VERSIONS
--------------------------------------
Operating System: CachyOS Linux 
KDE Plasma Version: 6.5.3
KDE Frameworks Version: 6.20.0
Qt Version: 6.10.0
Kernel Version: 6.17.8-2-cachyos (64-bit)
Graphics Platform: Wayland
Comment 1 Nate Graham 2025-12-09 23:21:11 UTC
In your screenshot, there's a clock widget in between two flexible spacers. The clock can't be centered in the panel when the global menu is visible because it takes up more than half the space in the panel. So instead it tries to get as close to the center as possible anyway.

Are you asking if it's possible for the clock to be centered in the empty area of the panel?
Comment 2 LeoHart 2025-12-10 01:14:13 UTC
(In reply to Nate Graham from comment #1)
> In your screenshot, there's a clock widget in between two flexible spacers.
> The clock can't be centered in the panel when the global menu is visible
> because it takes up more than half the space in the panel. So instead it
> tries to get as close to the center as possible anyway.
> 
> Are you asking if it's possible for the clock to be centered in the empty
> area of the panel?

This is exactly my attempt.
In my opinion, the order [Global Menu > Flexible Spacer > Clock > Flexible Spacer] should place the clock in the middle of the available free space.  It works perfectly without the global menu.
Comment 3 Nate Graham 2025-12-10 19:58:50 UTC
Thanks. At the moment it doesn't have this feature; its purpose is really to help you center things on the panel itself, not in the non-centered available space.

It would be possible to add this functionality, though.