From 75a4d98edcb74caba1c9027a6e84cec79554ef3f Mon Sep 17 00:00:00 2001 From: Sermak Date: Sat, 13 Nov 2021 01:15:37 +0100 Subject: [PATCH] [PATCH] Simulate toggleable fullscreen mode --- config.def.h | 3 ++- config.h | 1 + dwm.c | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/config.def.h b/config.def.h index e251649..2c224fe 100644 --- a/config.def.h +++ b/config.def.h @@ -84,7 +84,8 @@ static Key keys[] = { { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_c, setlayout, {.v = &layouts[3]} }, - { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_f, fullscreen, {0} }, + { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, diff --git a/config.h b/config.h index 78aa060..7605e31 100644 --- a/config.h +++ b/config.h @@ -112,6 +112,7 @@ static Key keys[] = { { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, + { MODKEY|ShiftMask, XK_g, fullscreen, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, diff --git a/dwm.c b/dwm.c index 59ea47f..af4b80b 100644 --- a/dwm.c +++ b/dwm.c @@ -242,6 +242,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); @@ -1785,6 +1786,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) {