Adding focusonnetactive and losefullscreen patches

This commit is contained in:
bakkeby 2019-09-07 00:03:04 +02:00
parent ec546d7995
commit 27b6b4b024
3 changed files with 45 additions and 1 deletions

View File

@ -11,7 +11,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
2019-09-06 - Added attachabove, attachaside, attachbelow, attachbottom and autostart patches
2019-09-06 - Added attachabove, attachaside, attachbelow, attachbottom, autostart, fancybar, focusonnetactive and losefullscreen patches
2019-09-05 - Alpha, systray, togglefullscreen, tagallmon, tagmonfixfs, tagswapmon, pertag and zoomswap patches added
@ -38,6 +38,15 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [fancybar](https://dwm.suckless.org/patches/fancybar/)
- shows the titles of all visible windows in the status bar
- [focusonnetactive](https://dwm.suckless.org/patches/focusonnetactive/)
- by default, dwm responds to \_NET_ACTIVE_WINDOW client messages by setting the urgency bit on the named window
- this patch activates the window instead
- [losefullscreen](https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-losefullscreen-6.2.diff)
- by default in dwm it is possible to make an application fullscreen, then use the focusstack keybindings to focus on other windows beneath the current window
- it is also possible to spawn new windows (e.g. a terminal) that end up getting focus while the previous window remains in fullscreen
- this patch ensures that in such scenarios the previous window loses fullscreen
- [pertag](https://dwm.suckless.org/patches/pertag/)
- adds nmaster, mfact, layouts and more per tag rather than per monitor

20
dwm.c
View File

@ -564,6 +564,9 @@ clientmessage(XEvent *e)
#endif // SYSTRAY_PATCH
XClientMessageEvent *cme = &e->xclient;
Client *c = wintoclient(cme->window);
#if FOCUSONNETACTIVE_PATCH
unsigned int i;
#endif // FOCUSONNETACTIVE_PATCH
#if SYSTRAY_PATCH
if (showsystray && cme->window == systray->win && cme->message_type == netatom[NetSystemTrayOP]) {
@ -618,8 +621,19 @@ clientmessage(XEvent *e)
setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
} else if (cme->message_type == netatom[NetActiveWindow]) {
#if FOCUSONNETACTIVE_PATCH
for (i = 0; i < LENGTH(tags) && !((1 << i) & c->tags); i++);
if (i < LENGTH(tags)) {
const Arg a = {.ui = 1 << i};
selmon = c->mon;
view(&a);
focus(c);
restack(selmon);
}
#else
if (c != selmon->sel && !c->isurgent)
seturgent(c, 1);
#endif // FOCUSONNETACTIVE_PATCH
}
}
@ -1001,6 +1015,12 @@ focus(Client *c)
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
}
selmon->sel = c;
#if LOSEFULLSCREEN_PATCH
Client *at;
for (at = selmon->clients; at; at = at->next)
if (at != c && at->isfullscreen && ISVISIBLE(at))
setfullscreen(at, 0);
#endif // LOSEFULLSCREEN_PATCH
drawbars();
}

View File

@ -50,6 +50,21 @@
*/
#define FANCYBAR_PATCH 0
/* By default, dwm responds to _NET_ACTIVE_WINDOW client messages by setting
* the urgency bit on the named window. This patch activates the window instead.
* https://dwm.suckless.org/patches/focusonnetactive/
*/
#define FOCUSONNETACTIVE_PATCH 0
/* By default in dwm it is possible to make an application fullscreen, then use
* the focusstack keybindings to focus on other windows beneath the current window.
* It is also possible to spawn new windows (e.g. a terminal) that end up getting
* focus while the previous window remains in fullscreen. This patch ensures that
* in such scenarios the previous window loses fullscreen.
* https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-losefullscreen-6.2.diff
*/
#define LOSEFULLSCREEN_PATCH 0
/* The pertag patch adds nmaster, mfacts and layouts per tag rather
* than per monitor (default).
* https://dwm.suckless.org/patches/pertag/