Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i3bar: progressively shorten blocks when bar is too wide #4113

Closed
ammgws opened this issue May 30, 2020 · 4 comments · Fixed by #5818
Closed

i3bar: progressively shorten blocks when bar is too wide #4113

ammgws opened this issue May 30, 2020 · 4 comments · Fixed by #5818
Labels
accepted Has been approved and is ok to start working on enhancement

Comments

@ammgws
Copy link
Contributor

ammgws commented May 30, 2020

I'm submitting a…

[ ] Bug
[x] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

When the predicted bar width is too wide, i3bar will switch every block over to its short_text mode.

Desired Behavior

When the predicted bar width is too wide, i3bar will progressively switch blocks over to short_text mode until the width requirement is satisfied. The idea is to use short_text only for the minimum of needed blocks.

Glancing over the code it seems doable, so I would be willing to give it a shot if this FR is accepted.

@GladOSkar
Copy link

I think this would be a very nice addition. Maybe it should be optional to avoid unexpected behavior for users of very narrow (vertical) screens who might want all blocks to be in short mode.

@orestisfl
Copy link
Member

This seems like a strict upgrade that doesn't require any configuration so I don't see why not.

@Zocker1999NET
Copy link

Zocker1999NET commented Aug 13, 2021

This maybe could also be combined with a preference factor (of keeping full size) which can be given by the JSON api. Meaning that blocks with a lower preference value are tried to shorten before blocks with a higher preference value. To make the implementation easy, I would define that for each preference level used, it will be tried to gain enough place by only use short_text on blocks with this level or lower. If blocks with a higher preference need to use short_text as well, assume all blocks of the current selected level to use short_text, increase the level to the next one used and retry the same until all blocks must use short_text.

Would this also be feasible for i3bar? I can implement the preference part, I think, but could not easily build an efficient algorithm trying to shorten the minimum needed blocks (either with or without a preference value).

@Airblader
Copy link
Member

I would like to avoid expanding the protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Has been approved and is ok to start working on enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants