sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-statuspadding-6.3.diff (2409B)


      1 From d6dd69c26f4272f87672ae54f69dc0d48650d34b Mon Sep 17 00:00:00 2001
      2 From: taep96 <64481039+taep96@users.noreply.github.com>
      3 Date: Mon, 7 Feb 2022 19:09:45 +0100
      4 Subject: [PATCH] Fixed | Replaces magic numbers in statusbar with configurable
      5  variables.
      6 
      7 horizpadbar for horizontal statusbar padding
      8 vertpadbar for vertical statusbar padding
      9 
     10 StatusText now has both left and right padding,
     11 as well as the vertical padding that all of the statusbar shares.
     12 
     13 Other than the addition of left padding to StatusText, appearance
     14 of the statusbar is identical to pre-patch when using the defaults
     15 in config.def.h
     16 ---
     17  config.def.h | 2 ++
     18  dwm.c        | 8 ++++----
     19  2 files changed, 6 insertions(+), 4 deletions(-)
     20 
     21 diff --git a/config.def.h b/config.def.h
     22 index a2ac963..6cb845c 100644
     23 --- a/config.def.h
     24 +++ b/config.def.h
     25 @@ -5,6 +5,8 @@ static const unsigned int borderpx  = 1;        /* border pixel of windows */
     26  static const unsigned int snap      = 32;       /* snap pixel */
     27  static const int showbar            = 1;        /* 0 means no bar */
     28  static const int topbar             = 1;        /* 0 means bottom bar */
     29 +static const int horizpadbar        = 2;        /* horizontal padding for statusbar */
     30 +static const int vertpadbar         = 0;        /* vertical padding for statusbar */
     31  static const char *fonts[]          = { "monospace:size=10" };
     32  static const char dmenufont[]       = "monospace:size=10";
     33  static const char col_gray1[]       = "#222222";
     34 diff --git a/dwm.c b/dwm.c
     35 index a96f33c..a1b8c95 100644
     36 --- a/dwm.c
     37 +++ b/dwm.c
     38 @@ -708,8 +708,8 @@ drawbar(Monitor *m)
     39  	/* draw status first so it can be overdrawn by tags later */
     40  	if (m == selmon) { /* status is only drawn on selected monitor */
     41  		drw_setscheme(drw, scheme[SchemeNorm]);
     42 -		tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
     43 -		drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
     44 +		tw = TEXTW(stext);
     45 +		drw_text(drw, m->ww - tw, 0, tw, bh, lrpad / 2, stext, 0);
     46  	}
     47  
     48  	for (c = m->clients; c; c = c->next) {
     49 @@ -1548,8 +1548,8 @@ setup(void)
     50  	drw = drw_create(dpy, screen, root, sw, sh);
     51  	if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
     52  		die("no fonts could be loaded.");
     53 -	lrpad = drw->fonts->h;
     54 -	bh = drw->fonts->h + 2;
     55 +	lrpad = drw->fonts->h + horizpadbar;
     56 +	bh = drw->fonts->h + vertpadbar;
     57  	updategeom();
     58  	/* init atoms */
     59  	utf8string = XInternAtom(dpy, "UTF8_STRING", False);
     60 -- 
     61 2.35.1
     62