From 0bb5e4dae1d74b0f8a8456c1562125e7c9854cf8 Mon Sep 17 00:00:00 2001 From: Ryan Kes <> Date: Tue, 1 Dec 2020 11:20:51 +0100 Subject: [PATCH] feat: added statuspadding patch --- PKGBUILD | 6 ++-- README.org | 1 + config_desktop.h | 2 ++ local-scratchpad-6.2.diff | 28 +++++++++++++++--- local-statuspadding-20150524-c8e9479.diff | 36 +++++++++++++++++++++++ 5 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 local-statuspadding-20150524-c8e9479.diff diff --git a/PKGBUILD b/PKGBUILD index 4d31a17..5a4754e 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -25,6 +25,7 @@ _patches=( "local-scratchpad-6.2.diff" "local-alpha-20201019-61bb8b2.diff" "dwm-rotatestack-20161021-ab9571b.diff" + "local-statuspadding-20150524-c8e9479.diff" ) source=(http://dl.suckless.org/dwm/dwm-$pkgver.tar.gz @@ -42,9 +43,10 @@ md5sums=('9929845ccdec4d2cc191f16210dd7f3d' 'ed77898009dea962f66a9dd607729549' '8c3ad89cb98dd2b9152075b6e29cb579' 'c446b71a8b8cce25db86a47805500dfa' - '8e7bef8198d212f8c33efbf160b44b87' + '595df893d829b2994bb799d12a1c9545' '3f50d21e606afd5c8b3c67dbbbb9ea32' - '882e0783ccedf9fbb8b565e7681116c9') + '882e0783ccedf9fbb8b565e7681116c9' + 'e08026fd0301284fc59b5652da22e994') prepare() { cd $srcdir/dwm-$pkgver diff --git a/README.org b/README.org index 03751a6..41caad4 100644 --- a/README.org +++ b/README.org @@ -14,6 +14,7 @@ - [[https://dwm.suckless.org/patches/rotatestack/][rotatestack]] - [[https://dwm.suckless.org/patches/scratchpad/][scratchpad]] - [[https://dwm.suckless.org/patches/selfrestart/][selfrestart]] +- [[https://dwm.suckless.org/patches/statuspadding/][statuspadding]] - [[https://dwm.suckless.org/patches/systray/][systray]] ** Installation diff --git a/config_desktop.h b/config_desktop.h index 3213e23..3b07964 100644 --- a/config_desktop.h +++ b/config_desktop.h @@ -9,6 +9,8 @@ static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display static const int showsystray = 1; /* 0 means no systray */ 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[] = { "Hack Nerd Font Mono:size=10:antialias=true:autohint=true", diff --git a/local-scratchpad-6.2.diff b/local-scratchpad-6.2.diff index f0bb367..530334c 100644 --- a/local-scratchpad-6.2.diff +++ b/local-scratchpad-6.2.diff @@ -1,3 +1,23 @@ +diff -up -N a/config.def.h b/config.def.h +--- a/config.def.h 2020-12-01 11:12:09.214062117 +0100 ++++ b/config.def.h 2020-12-01 11:15:20.540986211 +0100 +@@ -72,6 +74,8 @@ static const Layout layouts[] = { + static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ + static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; + static const char *termcmd[] = { "st", NULL }; ++static const char scratchpadname[] = "scratchpad"; ++static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL }; + + #include "selfrestart.c" + +@@ -79,6 +83,7 @@ static Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, ++ { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } }, + { MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } }, diff -up a/dwm.c b/dwm.c --- a/dwm.c 2019-06-06 21:23:27.023328450 +0200 +++ b/dwm.c 2019-06-20 15:07:01.089767947 +0200 @@ -12,16 +32,16 @@ diff -up a/dwm.c b/dwm.c @@ -273,6 +274,8 @@ static Window root, wmcheckwin; /* configuration, allows nested code to access above variables */ #include "config.h" - + +static unsigned int scratchtag = 1 << LENGTH(tags); + /* compile-time check if all tags fit into an unsigned int bit array. */ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; - + @@ -1052,6 +1055,14 @@ manage(Window w, XWindowAttributes *wa) && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); c->bw = borderpx; - + + selmon->tagset[selmon->seltags] &= ~scratchtag; + if (!strcmp(c->name, scratchpadname)) { + c->mon->tagset[c->mon->seltags] |= c->tags = scratchtag; @@ -43,7 +63,7 @@ diff -up a/dwm.c b/dwm.c close(ConnectionNumber(dpy)); @@ -1748,6 +1760,28 @@ togglefloating(const Arg *arg) } - + void +togglescratch(const Arg *arg) +{ diff --git a/local-statuspadding-20150524-c8e9479.diff b/local-statuspadding-20150524-c8e9479.diff new file mode 100644 index 0000000..97a8321 --- /dev/null +++ b/local-statuspadding-20150524-c8e9479.diff @@ -0,0 +1,36 @@ +diff -up -N a/config.def.h b/config.def.h +--- a/config.def.h 2020-12-01 11:12:09.214062117 +0100 ++++ b/config.def.h 2020-12-01 11:15:20.540986211 +0100 +@@ -9,6 +9,8 @@ static const int systraypinningfailfirst + static const int showsystray = 1; /* 0 means no systray */ + 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"; +--- a/dwm.c 2020-12-01 11:12:09.214062117 +0100 ++++ b/dwm.c 2020-12-01 11:13:44.657524937 +0100 +@@ -844,8 +844,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]); +- sw = TEXTW(stext) - lrpad / 2 + 2; /* 2px right padding */ +- drw_text(drw, m->ww - sw - stw, 0, sw, bh, lrpad / 2 - 2, stext, 0); ++ sw = TEXTW(stext); ++ drw_text(drw, m->ww - sw, 0, sw, bh, lrpad / 2, stext, 0); + } + + resizebarwin(m); +@@ -1913,8 +1913,8 @@ setup(void) + drw = drw_create(dpy, screen, root, sw, sh, visual, depth, cmap); + 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);