bakkeby / dwm-flexipatch

A dwm build with preprocessor directives to decide which patches to include during build time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How does bar_height vertpadbar work together?

SisyphusIsntHappy opened this issue · comments

Both seems to affect the vertical width of the bar. How are they related?

Regards

In a bare dwm you have that the height of the bar is derived from the height of the font, and the same goes for the left and right padding.

    lrpad = drw->fonts->h;
    bh = drw->fonts->h + 2;

For example let's say that I have my font set up like this:

static const char *fonts[]          = { "Roboto Mono Medium for Powerline:size=11" };

The height of the font is 14 pixels, so the height of the bar becomes 16 pixels and the left and right padding will be 14 pixels.


The bar height patch allows for a fixed height of the bar to be set.

    bh = bar_height ? bar_height : drw->fonts->h + 2;

If the bar_height variable is set to 20 then the bar will have a height of 20 pixels, regardless of the size of the font.

Likewise you could set the variable to 10 pixels and the bar would have that height even if there is not enough space to draw the whole characters.

Setting the value to 0 will make it fall back to the original behaviour of deriving the bar height from the font.


The statuspadding patch allows for the bar height and the left and right padding to be adjusted (padded).

What this means is that dwm will still derive the bar height and left and right padding based on the height of the primary font, but it will add the amount of padding specified.

static const int horizpadbar             = 2;   /* horizontal padding for statusbar */
static const int vertpadbar              = 6;   /* vertical padding for statusbar */
    lrpad = drw->fonts->h + horizpadbar;
    bh = drw->fonts->h + vertpadbar;

Continuing with the same example we have a font that is 14 pixels. The vertpadbar is 6 pixels here so the bar height becomes 20 pixels. The left and right padding then becomes 16 pixels because horizpadbar is set to 2.


As for how the two patches work together; it doesn't make any logical sense to combine the two patches so if both are enabled via patches.h then the statuspadding patch will take precedence over the bar height patch.

And here I was loosing my mind reading the source.

Thank you for taking the time to clarify.

A suggestion, shouldn't the comment of patches.def.h be modified to incorporate the info that there is not need to use the both? Because some for other patches that is being said in the comments.