Skip to content

Commit

Permalink
statuspadding patch
Browse files Browse the repository at this point in the history
  • Loading branch information
t4pZ committed Jul 14, 2023
1 parent 713a69e commit 9effb42
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 4 deletions.
2 changes: 2 additions & 0 deletions dwm/config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ static const unsigned int gappov = 30; /* vert outer gap between window
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const int horizpadbar = 2; /* horizontal padding for statusbar */
static const int vertpadbar = 0; /* vertical padding for statusbar */
static const char *fonts[] = { "JetBrainsMono Nerd Font:size=11" };
static const char dmenufont[] = "JetBrainsMono Nerd Font:size=11";
static const char col_gray1[] = "#1e1e2e"; /* bg normal */
Expand Down
2 changes: 2 additions & 0 deletions dwm/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ static const unsigned int gappov = 30; /* vert outer gap between window
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const int horizpadbar = 2; /* horizontal padding for statusbar */
static const int vertpadbar = 0; /* vertical padding for statusbar */
static const char *fonts[] = { "JetBrainsMono Nerd Font:size=11" };
static const char dmenufont[] = "JetBrainsMono Nerd Font:size=11";
static const char col_gray1[] = "#1e1e2e"; /* bg normal */
Expand Down
Binary file modified dwm/dwm
Binary file not shown.
8 changes: 4 additions & 4 deletions dwm/dwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,8 @@ drawbar(Monitor *m)
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
tw = TEXTW(stext);
drw_text(drw, m->ww - tw, 0, tw, bh, lrpad / 2, stext, 0);
}

for (c = m->clients; c; c = c->next) {
Expand Down Expand Up @@ -1693,8 +1693,8 @@ setup(void)
drw = drw_create(dpy, screen, root, sw, sh);
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
die("no fonts could be loaded.");
lrpad = drw->fonts->h;
bh = drw->fonts->h + 2;
lrpad = drw->fonts->h + horizpadbar;
bh = drw->fonts->h + vertpadbar;
updategeom();
/* init atoms */
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
Expand Down
Binary file modified dwm/dwm.o
Binary file not shown.
62 changes: 62 additions & 0 deletions dwm/patches/dwm-statuspadding-6.3.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
From d6dd69c26f4272f87672ae54f69dc0d48650d34b Mon Sep 17 00:00:00 2001
From: taep96 <[email protected]>
Date: Mon, 7 Feb 2022 19:09:45 +0100
Subject: [PATCH] Fixed | Replaces magic numbers in statusbar with configurable
variables.

horizpadbar for horizontal statusbar padding
vertpadbar for vertical statusbar padding

StatusText now has both left and right padding,
as well as the vertical padding that all of the statusbar shares.

Other than the addition of left padding to StatusText, appearance
of the statusbar is identical to pre-patch when using the defaults
in config.def.h
---
config.def.h | 2 ++
dwm.c | 8 ++++----
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/config.def.h b/config.def.h
index a2ac963..6cb845c 100644
--- a/config.def.h
+++ b/config.def.h
@@ -5,6 +5,8 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
+static const int horizpadbar = 2; /* horizontal padding for statusbar */
+static const int vertpadbar = 0; /* vertical padding for statusbar */
static const char *fonts[] = { "monospace:size=10" };
static const char dmenufont[] = "monospace:size=10";
static const char col_gray1[] = "#222222";
diff --git a/dwm.c b/dwm.c
index a96f33c..a1b8c95 100644
--- a/dwm.c
+++ b/dwm.c
@@ -708,8 +708,8 @@ drawbar(Monitor *m)
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
- tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
- drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
+ tw = TEXTW(stext);
+ drw_text(drw, m->ww - tw, 0, tw, bh, lrpad / 2, stext, 0);
}

for (c = m->clients; c; c = c->next) {
@@ -1548,8 +1548,8 @@ setup(void)
drw = drw_create(dpy, screen, root, sw, sh);
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
die("no fonts could be loaded.");
- lrpad = drw->fonts->h;
- bh = drw->fonts->h + 2;
+ lrpad = drw->fonts->h + horizpadbar;
+ bh = drw->fonts->h + vertpadbar;
updategeom();
/* init atoms */
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
--
2.35.1

0 comments on commit 9effb42

Please sign in to comment.