diff options
| -rw-r--r-- | PKGBUILD | 2 | ||||
| -rw-r--r-- | README.md | 9 | ||||
| -rw-r--r-- | dwm.c | 11 | ||||
| -rw-r--r-- | patches/dwm-focusonnetactive-6.2.diff | 57 |
4 files changed, 72 insertions, 7 deletions
@@ -16,7 +16,7 @@ source=( 'movestack.c' 'selfrestart.c' ) md5sums=( - '60fd1bd6bca80c5efa3cf30516a9c456' + '149ff5a0b678bfde004d4663345f317b' '37881ae1d06884f38b731b9103c9f373' '2170b6fe645068a2cad4be60d5ebbd84' 'e1d877b57636568ba579b1bc0ae42e8f' @@ -3,10 +3,11 @@ Forked from [dwm-v6.2](https://dwm.suckless.org/) Installed patches: -* [actualfullscreen](https://dwm.suckless.org/patches/actualfullscreen/) for actual toggling of fullscreen for window -* [systray](https://dwm.suckless.org/patches/systray/) for simple system tray implementation -* [tilegap](https://dwm.suckless.org/patches/tilegap/) for nice gaps between windows -* [scratchpads](https://dwm.suckless.org/patches/scratchpads/) for scratchpads support +* [actualfullscreen](https://dwm.suckless.org/patches/actualfullscreen/) +* [systray](https://dwm.suckless.org/patches/systray/) +* [tilegap](https://dwm.suckless.org/patches/tilegap/) +* [scratchpads](https://dwm.suckless.org/patches/scratchpads/) * [movestack](https://dwm.suckless.org/patches/movestack/) * [resizecorners](https://dwm.suckless.org/patches/resizecorners/) * [selfrestart](https://dwm.suckless.org/patches/selfrestart/) +* [focusonnetactive](https://dwm.suckless.org/patches/focusonnetactive/) @@ -567,6 +567,7 @@ clientmessage(XEvent *e) XSetWindowAttributes swa; XClientMessageEvent *cme = &e->xclient; Client *c = wintoclient(cme->window); + unsigned int i; if (showsystray && cme->window == systray->win && cme->message_type == netatom[NetSystemTrayOP]) { /* add systray icons */ @@ -622,8 +623,14 @@ 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 (c != selmon->sel && !c->isurgent) - seturgent(c, 1); + 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); + } } } diff --git a/patches/dwm-focusonnetactive-6.2.diff b/patches/dwm-focusonnetactive-6.2.diff new file mode 100644 index 0000000..5d358d2 --- /dev/null +++ b/patches/dwm-focusonnetactive-6.2.diff @@ -0,0 +1,57 @@ +From 286ca3bb1af08b452bf8140abcc23d4ef61baaa2 Mon Sep 17 00:00:00 2001 +From: bakkeby <bakkeby@gmail.com> +Date: Tue, 7 Apr 2020 12:33:04 +0200 +Subject: [PATCH] Activate a window in response to _NET_ACTIVE_WINDOW + +By default, dwm response to client requests to _NET_ACTIVE_WINDOW client +messages by setting the urgency bit on the named window. + +This patch activates the window instead. + +Both behaviours are legitimate according to +https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472702304 + +One should decide which of these one should perform based on the message +senders' untestable claims that it represents the end-user. Setting the +urgency bit is the conservative decision. This patch implements the more +trusting alternative. + +It also allows dwm to work with `wmctrl -a` and other external window +management utilities + +--- + dwm.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/dwm.c b/dwm.c +index 4465af1..3919d47 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -514,6 +514,7 @@ clientmessage(XEvent *e) + { + XClientMessageEvent *cme = &e->xclient; + Client *c = wintoclient(cme->window); ++ unsigned int i; + + if (!c) + return; +@@ -523,8 +524,14 @@ 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 (c != selmon->sel && !c->isurgent) +- seturgent(c, 1); ++ 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); ++ } + } + } + +-- +2.17.1 + |