From af8c9d2e1b0ad8c686cbacc46a296d7f91e00e2e Mon Sep 17 00:00:00 2001 From: bakkeby Date: Tue, 7 Apr 2020 12:25:58 +0200 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 1c0b587..666d0c4 100644 --- a/config.def.h +++ b/config.def.h @@ -78,6 +78,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 4465af1..bcc6ce2 100644 --- a/dwm.c +++ b/dwm.c @@ -211,6 +211,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); @@ -1719,6 +1720,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