greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.87k stars 472 forks source link

Giving a block a minimum width when using a variable width font #1420

Open agraven opened 2 years ago

agraven commented 2 years ago

Reading the documentation, I can't seem to find a way to give a block a minimum width in pixels. This means that when you use a variable width font, trying to use spaces for padding means that the width constantly changes as padding characters are inserted or replaced with non-padding characters, e.g. when displaying CPU utilization.

For reference, the way i3blocks implements this is that it lets you set the min width of a block as the width of a given string in the currently active font, so the way you set the minimum width of a CPU usage block is with min_width = 100.00%.

ammgws commented 2 years ago

I assume they are just setting min_width as per the i3bar IPC docs: https://i3wm.org/docs/i3bar-protocol.html

We also use that somewhere - I think the rotating text widget for the music block, but I guess it might be possible to add it as per-block config option too. @GladOSkar Any thoughts?

GladOSkar commented 2 years ago

Could probably be added as another variable format modifier. I don't think that had any concept of pixels as of yet, so i'd probably also go with the string option

daviddgm commented 2 years ago

I reduced this problem using fixed font for CPU utilization: format = "{utilization:3} {frequency}"

nsirolli commented 1 year ago

I'm having the same problem with variable width icons (e.g., the icon used in the sound block).