nixos/suckless/dwm-patches/2-fullscreen.diff
2022-09-30 14:46:28 -04:00

44 lines
1.5 KiB
Diff

diff --git a/config.def.h b/config.def.h
index 7dd19b6..70f1d52 100644
--- a/config.def.h
+++ b/config.def.h
@@ -80,6 +80,7 @@ static const Key keys[] = {
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XK_f, fullscreen, {0} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
diff --git a/dwm.c b/dwm.c
index e9e3934..f125a4d 100644
--- a/dwm.c
+++ b/dwm.c
@@ -205,6 +205,7 @@ static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen);
+static void fullscreen(const Arg *arg);
static void setgaps(const Arg *arg);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
@@ -1546,6 +1547,19 @@ setgaps(const Arg *arg)
arrange(selmon);
}
+Layout *last_layout;
+void
+fullscreen(const Arg *arg)
+{
+ if (selmon->showbar) {
+ for(last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
+ setlayout(&((Arg) { .v = &layouts[2] }));
+ } else {
+ setlayout(&((Arg) { .v = last_layout }));
+ }
+ togglebar(arg);
+}
+
void
setlayout(const Arg *arg)
{