i3status-rust icon indicating copy to clipboard operation
i3status-rust copied to clipboard

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

Open agraven opened this issue 3 years ago • 4 comments

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%.

agraven avatar Feb 02 '22 11:02 agraven

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?

ammgws avatar Feb 02 '22 11:02 ammgws

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

GladOSkar avatar Feb 02 '22 11:02 GladOSkar

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

daviddgm avatar Feb 17 '22 20:02 daviddgm

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

nsirolli avatar Apr 30 '23 12:04 nsirolli