From 2a49bcf36a7bb8350dbd2650e6ba7d10e60a18c4 Mon Sep 17 00:00:00 2001 From: Bakkeby Date: Mon, 10 Jan 2022 13:52:51 +0100 Subject: [PATCH] togglefullscreen, allows you to toggle fullscreen on and off using the same shortcut key --- config.def.h | 1 + dwm.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/config.def.h b/config.def.h index a2ac963..bebb0fb 100644 --- a/config.def.h +++ b/config.def.h @@ -79,6 +79,7 @@ static Key keys[] = { { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_y, togglefullscreen, {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 a96f33c..897797f 100644 --- a/dwm.c +++ b/dwm.c @@ -212,6 +212,7 @@ static void tagmon(const Arg *arg); static void tile(Monitor *); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); +static void togglefullscreen(const Arg *arg); static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); static void unfocus(Client *c, int setfocus); @@ -1725,6 +1726,14 @@ togglefloating(const Arg *arg) arrange(selmon); } +void +togglefullscreen(const Arg *arg) { + if (!selmon->sel) + return; + + setfullscreen(selmon->sel, !selmon->sel->isfullscreen); +} + void toggletag(const Arg *arg) { -- 2.19.1