| dwm-focusfullscreen-20211121-95e7342.diff - sites - public wiki contents of suc… | |
| git clone git://git.suckless.org/sites | |
| Log | |
| Files | |
| Refs | |
| --- | |
| dwm-focusfullscreen-20211121-95e7342.diff (3259B) | |
| --- | |
| 1 From 95e7342ae91d1011ea90ae1214cc0df1f44f7856 Mon Sep 17 00:00:00 2001 | |
| 2 From: Hai Nguyen <[email protected]> | |
| 3 Date: Sun, 21 Nov 2021 00:43:21 -0500 | |
| 4 Subject: [PATCH] added togglefullscreen, modify focus(), unmanage() to b… | |
| 5 to cycle while in fullscreen | |
| 6 | |
| 7 --- | |
| 8 config.def.h | 4 ++-- | |
| 9 dwm.c | 21 ++++++++++++++++++++- | |
| 10 2 files changed, 22 insertions(+), 3 deletions(-) | |
| 11 | |
| 12 diff --git a/config.def.h b/config.def.h | |
| 13 index a2ac963..4e13392 100644 | |
| 14 --- a/config.def.h | |
| 15 +++ b/config.def.h | |
| 16 @@ -35,7 +35,7 @@ static const Rule rules[] = { | |
| 17 static const float mfact = 0.55; /* factor of master area size [0.0… | |
| 18 static const int nmaster = 1; /* number of clients in master are… | |
| 19 static const int resizehints = 1; /* 1 means respect size hints in t… | |
| 20 -static const int lockfullscreen = 1; /* 1 will force focus on the fulls… | |
| 21 +static const int lockfullscreen = 0; /* 1 will force focus on the fulls… | |
| 22 | |
| 23 static const Layout layouts[] = { | |
| 24 /* symbol arrange function */ | |
| 25 @@ -75,10 +75,10 @@ static Key keys[] = { | |
| 26 { MODKEY, XK_Tab, view, {0} … | |
| 27 { MODKEY|ShiftMask, XK_c, killclient, {0} … | |
| 28 { MODKEY, XK_t, setlayout, {.v … | |
| 29 - { MODKEY, XK_f, setlayout, {.v … | |
| 30 { MODKEY, XK_m, setlayout, {.v … | |
| 31 { MODKEY, XK_space, setlayout, {0} … | |
| 32 { MODKEY|ShiftMask, XK_space, togglefloating, {0} … | |
| 33 + { MODKEY, XK_f, … | |
| 34 { MODKEY, XK_0, view, {.ui… | |
| 35 { MODKEY|ShiftMask, XK_0, tag, {.ui… | |
| 36 { MODKEY, XK_comma, focusmon, {.i … | |
| 37 diff --git a/dwm.c b/dwm.c | |
| 38 index 5e4d494..56d96a7 100644 | |
| 39 --- a/dwm.c | |
| 40 +++ b/dwm.c | |
| 41 @@ -212,6 +212,7 @@ static void tagmon(const Arg *arg); | |
| 42 static void tile(Monitor *); | |
| 43 static void togglebar(const Arg *arg); | |
| 44 static void togglefloating(const Arg *arg); | |
| 45 +static void togglefullscreen(); | |
| 46 static void toggletag(const Arg *arg); | |
| 47 static void toggleview(const Arg *arg); | |
| 48 static void unfocus(Client *c, int setfocus); | |
| 49 @@ -802,7 +803,13 @@ focus(Client *c) | |
| 50 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentT… | |
| 51 XDeleteProperty(dpy, root, netatom[NetActiveWindow]); | |
| 52 } | |
| 53 - selmon->sel = c; | |
| 54 + if(selmon->sel && selmon->sel->isfullscreen){ | |
| 55 + togglefullscreen(); | |
| 56 + selmon->sel = c; | |
| 57 + togglefullscreen(); | |
| 58 + }else{ | |
| 59 + selmon->sel = c; | |
| 60 + } | |
| 61 drawbars(); | |
| 62 } | |
| 63 | |
| 64 @@ -1722,6 +1729,14 @@ togglefloating(const Arg *arg) | |
| 65 arrange(selmon); | |
| 66 } | |
| 67 | |
| 68 +void | |
| 69 +togglefullscreen() | |
| 70 +{ | |
| 71 + if (selmon->sel){ | |
| 72 + setfullscreen(selmon->sel, !selmon->sel->isfullscreen); | |
| 73 + } | |
| 74 +} | |
| 75 + | |
| 76 void | |
| 77 toggletag(const Arg *arg) | |
| 78 { | |
| 79 @@ -1767,6 +1782,7 @@ unmanage(Client *c, int destroyed) | |
| 80 { | |
| 81 Monitor *m = c->mon; | |
| 82 XWindowChanges wc; | |
| 83 + int fullscreen = (selmon->sel == c && selmon->sel->isfullscreen… | |
| 84 | |
| 85 detach(c); | |
| 86 detachstack(c); | |
| 87 @@ -1783,6 +1799,9 @@ unmanage(Client *c, int destroyed) | |
| 88 } | |
| 89 free(c); | |
| 90 focus(NULL); | |
| 91 + if(fullscreen){ | |
| 92 + togglefullscreen(); | |
| 93 + } | |
| 94 updateclientlist(); | |
| 95 arrange(m); | |
| 96 } | |
| 97 -- | |
| 98 2.34.0 | |
| 99 |