From 448f8db4c28b91418abfc461304aebd4530a4cfc Mon Sep 17 00:00:00 2001 From: bakkeby Date: Thu, 5 Sep 2019 23:27:33 +0200 Subject: [PATCH] Adding togglefullscreen patch --- README.md | 5 ++++- config.def.h | 3 +++ patch/include.c | 6 +++++- patch/include.h | 6 +++++- patch/togglefullscreen.c | 7 +++++++ patch/togglefullscreen.h | 1 + patches.h | 6 ++++++ 7 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 patch/togglefullscreen.c create mode 100644 patch/togglefullscreen.h diff --git a/README.md b/README.md index f8d6440..cc279b9 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: -2019-09-05 - Alpha, systray, pertag and zoomswap patches added +2019-09-05 - Alpha, systray, togglefullscreen, pertag and zoomswap patches added ### Patches included: @@ -24,6 +24,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t - [systray](https://dwm.suckless.org/patches/systray/) - adds system tray in the status bar + - [togglefullscreen](https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-togglefullscreen-6.2.diff) + - allows you to toggle fullscreen on and off using a single shortcut key + - [zoomswap](https://dwm.suckless.org/patches/zoomswap/) - allows a master and a stack window to swap places rather than every window on the screen changing position diff --git a/config.def.h b/config.def.h index 12a0753..f29f623 100644 --- a/config.def.h +++ b/config.def.h @@ -93,6 +93,9 @@ static Key keys[] = { { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + #if TOGGLEFULLSCREEN_PATCH + { MODKEY, XK_y, togglefullscreen, {0} }, + #endif // TOGGLEFULLSCREEN_PATCH { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, diff --git a/patch/include.c b/patch/include.c index d14c844..aa64108 100644 --- a/patch/include.c +++ b/patch/include.c @@ -10,6 +10,10 @@ #include "systray.c" #endif +#if TOGGLEFULLSCREEN_PATCH +#include "togglefullscreen.c" +#endif + #if ZOOMSWAP_PATCH #include "zoomswap.c" -#endif // ZOOMSWAP_PATCH +#endif diff --git a/patch/include.h b/patch/include.h index 52b0514..972bd4e 100644 --- a/patch/include.h +++ b/patch/include.h @@ -6,6 +6,10 @@ #include "systray.h" #endif +#if TOGGLEFULLSCREEN_PATCH +#include "togglefullscreen.h" +#endif + #if ZOOMSWAP_PATCH #include "zoomswap.h" -#endif // ZOOMSWAP_PATCH \ No newline at end of file +#endif \ No newline at end of file diff --git a/patch/togglefullscreen.c b/patch/togglefullscreen.c new file mode 100644 index 0000000..c0fa203 --- /dev/null +++ b/patch/togglefullscreen.c @@ -0,0 +1,7 @@ +void +togglefullscreen(const Arg *arg) { + if (!selmon->sel) + return; + + setfullscreen(selmon->sel, !selmon->sel->isfullscreen); +} \ No newline at end of file diff --git a/patch/togglefullscreen.h b/patch/togglefullscreen.h new file mode 100644 index 0000000..7e1126a --- /dev/null +++ b/patch/togglefullscreen.h @@ -0,0 +1 @@ +static void togglefullscreen(const Arg *arg); \ No newline at end of file diff --git a/patches.h b/patches.h index e452c28..d8068f5 100644 --- a/patches.h +++ b/patches.h @@ -28,6 +28,12 @@ */ #define PERTAGBAR_PATCH 0 + +/* This patch allows you to toggle fullscreen on and off using a single shortcut key. + * https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-togglefullscreen-6.2.diff + */ +#define TOGGLEFULLSCREEN_PATCH 1 + /* The zoomswap patch allows a master and a stack window to swap places * rather than every window on the screen changing position. * https://dwm.suckless.org/patches/zoomswap/