swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.64k stars 1.11k forks source link

Expand swaybar elements if min_width is -1 #6667

Open and3rson opened 2 years ago

and3rson commented 2 years ago

Description:

I propose to allow the setting of min_width property (swaybar JSON protocol) to a negative value in order to expand the element to take all available horizontal screen space. This should be fairly trivial to implement and I'd be eager to submit a PR if this gets approved.

Currently, it's possible to achieve a similar result for a certain element by subtracting the total width of all other elements (which can be easily calculated if the font is monospaced) from the width of the screen and appending the required amount of spaces before or after the full_text of the element that I want to expand. Obviously, this is very hacky, does not align well, and breaks if elements use different font families or sizes.

This change will not introduce any incompatible functionality since currently a negative value of min_width is simply ignored. I suggest putting this value to a good use and letting swaybar elements nicely occupy all available horizontal space, not just the right side.

TL;DR

and3rson commented 2 years ago

Bump

emersion commented 2 years ago

Unlikely to be accepted -- see https://github.com/swaywm/sway/blob/master/CONTRIBUTING.md#scope-of-future-changes-to-sway