dwm: Use actualfullscreen patch over monocle mode

Simplifies things a bit since we no longer need to worry about monocle
mode affecting all tags.
This commit is contained in:
Donovan Glover 2024-08-22 16:30:19 -04:00
parent ad0f0619fd
commit 5efc4364bb
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
3 changed files with 53 additions and 32 deletions

View File

@ -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)
{

View File

@ -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

View File

@ -113,7 +113,7 @@ in
package = pkgs.dwm.overrideAttrs (oldAttrs: { package = pkgs.dwm.overrideAttrs (oldAttrs: {
patches = oldAttrs.patches ++ [ patches = oldAttrs.patches ++ [
../assets/dwm-fix-monocle-transparency-background.patch ../assets/dwm-actualfullscreen.patch
(pkgs.fetchpatch { (pkgs.fetchpatch {
url = "https://dwm.suckless.org/patches/hide_vacant_tags/dwm-hide_vacant_tags-6.4.diff"; url = "https://dwm.suckless.org/patches/hide_vacant_tags/dwm-hide_vacant_tags-6.4.diff";