From 5efc4364bbe362d185e84b271d411d1e60ba3c18 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Thu, 22 Aug 2024 16:30:19 -0400 Subject: [PATCH] dwm: Use actualfullscreen patch over monocle mode Simplifies things a bit since we no longer need to worry about monocle mode affecting all tags. --- assets/dwm-actualfullscreen.patch | 52 +++++++++++++++++++ ...-fix-monocle-transparency-background.patch | 31 ----------- specializations/dwm.nix | 2 +- 3 files changed, 53 insertions(+), 32 deletions(-) create mode 100644 assets/dwm-actualfullscreen.patch delete mode 100644 assets/dwm-fix-monocle-transparency-background.patch diff --git a/assets/dwm-actualfullscreen.patch b/assets/dwm-actualfullscreen.patch new file mode 100644 index 00000000..15f0c65c --- /dev/null +++ b/assets/dwm-actualfullscreen.patch @@ -0,0 +1,52 @@ +diff --git a/config.def.h b/config.def.h +index 9efa774..5150c08 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -79,6 +79,7 @@ static const Key keys[] = { + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, ++ { MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, +diff --git a/dwm.1 b/dwm.1 +index ddc8321..3d310ac 100644 +--- a/dwm.1 ++++ b/dwm.1 +@@ -116,6 +116,9 @@ Zooms/cycles focused window to/from master area (tiled layouts only). + .B Mod1\-Shift\-c + Close focused window. + .TP ++.B Mod1\-Shift\-f ++Toggle fullscreen for focused window. ++.TP + .B Mod1\-Shift\-space + Toggle focused window between tiled and floating state. + .TP +diff --git a/dwm.c b/dwm.c +index 67c6b2b..4c20b38 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -211,6 +211,7 @@ static void tagmon(const Arg *arg); + static void tile(Monitor *m); + static void togglebar(const Arg *arg); + static void togglefloating(const Arg *arg); ++static void togglefullscr(const Arg *arg); + static void toggletag(const Arg *arg); + static void toggleview(const Arg *arg); + static void unfocus(Client *c, int setfocus); +@@ -1735,6 +1736,13 @@ togglefloating(const Arg *arg) + arrange(selmon); + } + ++void ++togglefullscr(const Arg *arg) ++{ ++ if(selmon->sel) ++ setfullscreen(selmon->sel, !selmon->sel->isfullscreen); ++} ++ + void + toggletag(const Arg *arg) + { diff --git a/assets/dwm-fix-monocle-transparency-background.patch b/assets/dwm-fix-monocle-transparency-background.patch deleted file mode 100644 index 084e0cff..00000000 --- a/assets/dwm-fix-monocle-transparency-background.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/dwm.c b/dwm.c -index 67c6b2b..59666f7 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -808,6 +808,8 @@ focus(Client *c) - XDeleteProperty(dpy, root, netatom[NetActiveWindow]); - } - selmon->sel = c; -+ if (selmon->lt[selmon->sellt]->arrange == monocle) -+ arrangemon(selmon); - drawbars(); - } - -@@ -1121,8 +1123,15 @@ monocle(Monitor *m) - n++; - if (n > 0) /* override layout symbol */ - snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n); -- for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) -- resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0); -+ for (c = m->stack; c && (!ISVISIBLE(c) || c->isfloating); c = c->snext); -+ if (c && !c->isfloating) { -+ XMoveWindow(dpy, c->win, m->wx, m->wy); -+ resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0); -+ c = c->snext; -+ } -+ for (; c; c = c->snext) -+ if (!c->isfloating && ISVISIBLE(c)) -+ XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y); - } - - void diff --git a/specializations/dwm.nix b/specializations/dwm.nix index 4f77d3ae..9f576c69 100644 --- a/specializations/dwm.nix +++ b/specializations/dwm.nix @@ -113,7 +113,7 @@ in package = pkgs.dwm.overrideAttrs (oldAttrs: { patches = oldAttrs.patches ++ [ - ../assets/dwm-fix-monocle-transparency-background.patch + ../assets/dwm-actualfullscreen.patch (pkgs.fetchpatch { url = "https://dwm.suckless.org/patches/hide_vacant_tags/dwm-hide_vacant_tags-6.4.diff";