From 5d59643d3c04d04563f0d414619972b8a524e4f7 Mon Sep 17 00:00:00 2001 From: kolunmi Date: Tue, 14 Feb 2023 19:25:32 -0700 Subject: [PATCH] add vertical_padding setting --- config.def.h | 3 +++ dwlb.c | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config.def.h b/config.def.h index e7349f9..47332c1 100644 --- a/config.def.h +++ b/config.def.h @@ -18,3 +18,6 @@ static pixman_color_t inactive_fg_color = { .red = 0xbbbb, .green = 0xbbbb, .blu static pixman_color_t inactive_bg_color = { .red = 0x2222, .green = 0x2222, .blue = 0x2222, .alpha = 0xffff, }; static pixman_color_t urgent_fg_color = { .red = 0x2222, .green = 0x2222, .blue = 0x2222, .alpha = 0xffff, }; static pixman_color_t urgent_bg_color = { .red = 0xeeee, .green = 0xeeee, .blue = 0xeeee, .alpha = 0xffff, }; + +// vertical pixel padding above and below text +static uint32_t vertical_padding = 1; diff --git a/dwlb.c b/dwlb.c index 444f231..f9e9f6a 100644 --- a/dwlb.c +++ b/dwlb.c @@ -63,13 +63,14 @@ " -bottom bars will initially be drawn at the bottom\n" \ " -no-bottom bars will initially be drawn at the top\n" \ " -font [FONT] specify a font\n" \ + " -tags [FIRST TAG]...[LAST TAG] specify custom tag names\n" \ + " -vertical-padding [PIXELS] specify vertical pixel padding above and below text\n" \ " -active-fg-color [COLOR] specify text color of active tags or monitors\n" \ " -active-bg-color [COLOR] specify background color of active tags or monitors\n" \ " -inactive-fg-color [COLOR] specify text color of inactive tags or monitors\n" \ " -inactive-fg-color [COLOR] specify background color of inactive tags or monitors\n" \ " -urgent-fg-color [COLOR] specify text color of urgent tags\n" \ " -urgent-bg-color [COLOR] specify background color of urgent tags\n" \ - " -tags [FIRST TAG]...[LAST TAG] specify custom tag names\n" \ "Commands\n" \ " -status [OUTPUT] [TEXT] set status text\n" \ " -show [OUTPUT] show bar\n" \ @@ -1048,6 +1049,10 @@ main(int argc, char **argv) if (++i >= argc) DIE("Option -font requires an argument"); fontstr = argv[i]; + } else if (!strcmp(argv[i], "-vertical-padding")) { + if (++i >= argc) + DIE("Option -vertical-padding requires an argument"); + vertical_padding = atoi(argv[i]); } else if (!strcmp(argv[i], "-active-fg-color")) { if (++i >= argc) DIE("Option -active-fg-color requires an argument"); @@ -1113,7 +1118,7 @@ main(int argc, char **argv) if (!font) DIE("Could not load font"); textpadding = font->height / 2; - height = font->ascent + font->descent; + height = font->height + vertical_padding * 2; /* Setup bars */ DL_FOREACH(bars, b)