aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Guihot2026-09-16 05:22:57 +1000
committerDaniel Guihot2026-09-16 05:22:57 +1000
commite0bb47559a2913c3b24c289a1471209321acca91 (patch)
tree4350aedd3591fed6461dac2acc7f4d725044baad
downloaddwm-fullscreenhook-e0bb47559a2913c3b24c289a1471209321acca91.tar.gz
dwm-fullscreenhook-e0bb47559a2913c3b24c289a1471209321acca91.zip
dwm 6.8 fullscreenhook patch
-rw-r--r--README.md30
-rw-r--r--dwm-fullscreenhook-6.8.diff60
2 files changed, 90 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..8957a6c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,30 @@
+# fullscreenhook
+
+## Description
+
+This patch publishes the active fullscreen window on the root window so other
+programs can react to it. It applies to dwm 6.8.
+
+dwm sets `_DWM_FULLSCREEN` to the window id of the fullscreen client when it
+enters fullscreen, and removes the property when it leaves or is unmanaged. A
+compositor, notification daemon or GameMode helper can watch it with:
+
+ xprop -root -spy _DWM_FULLSCREEN
+
+No configuration and no spawned commands.
+
+Assumes one fullscreen client at a time. With two, the property tracks the
+most recent one to enter.
+
+## Testing
+
+Applies and builds against dwm 6.8. Runtime tested under Xvfb: the property
+is set on enter and cleared on exit and on unmanage.
+
+## Download
+
+* [dwm-fullscreenhook-6.8.diff](dwm-fullscreenhook-6.8.diff)
+
+## Author
+
+* Daniel Guihot - [daniel@guihot.net](mailto:daniel@guihot.net)
diff --git a/dwm-fullscreenhook-6.8.diff b/dwm-fullscreenhook-6.8.diff
new file mode 100644
index 0000000..9d267c3
--- /dev/null
+++ b/dwm-fullscreenhook-6.8.diff
@@ -0,0 +1,60 @@
+From 8b2c41af886b758126c7738fbd302fc1dfcc3172 Mon Sep 17 00:00:00 2001
+From: Daniel Guihot <daniel@guihot.net>
+Date: Wed, 16 Sep 2026 05:09:22 +1000
+Subject: [PATCH] fullscreenhook: publish the fullscreen window on the root
+ window
+
+Set _DWM_FULLSCREEN on the root window to the window id of the client
+that is fullscreen and clear it when the client exits, so a compositor,
+notification daemon or GameMode helper can react without scanning every
+window. Assumes one fullscreen client at a time.
+---
+ dwm.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/dwm.c b/dwm.c
+index 53b393e..1868c5c 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -258,7 +258,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
+ [PropertyNotify] = propertynotify,
+ [UnmapNotify] = unmapnotify
+ };
+-static Atom wmatom[WMLast], netatom[NetLast];
++static Atom wmatom[WMLast], netatom[NetLast], dwmfullscreen;
+ static int running = 1;
+ static Cur *cursor[CurLast];
+ static Clr **scheme;
+@@ -1492,9 +1492,12 @@ setfullscreen(Client *c, int fullscreen)
+ c->isfloating = 1;
+ resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
+ XRaiseWindow(dpy, c->win);
++ XChangeProperty(dpy, root, dwmfullscreen, XA_WINDOW, 32,
++ PropModeReplace, (unsigned char *)&c->win, 1);
+ } else if (!fullscreen && c->isfullscreen){
+ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
+ PropModeReplace, (unsigned char*)0, 0);
++ XDeleteProperty(dpy, root, dwmfullscreen);
+ c->isfullscreen = 0;
+ c->isfloating = c->oldstate;
+ c->bw = c->oldbw;
+@@ -1579,6 +1582,7 @@ setup(void)
+ netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
+ netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
+ netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
++ dwmfullscreen = XInternAtom(dpy, "_DWM_FULLSCREEN", False);
+ /* init cursors */
+ cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
+ cursor[CurResize] = drw_cur_create(drw, XC_sizing);
+@@ -1783,6 +1787,8 @@ unmanage(Client *c, int destroyed)
+
+ detach(c);
+ detachstack(c);
++ if (c->isfullscreen)
++ XDeleteProperty(dpy, root, dwmfullscreen);
+ if (!destroyed) {
+ wc.border_width = c->oldbw;
+ XGrabServer(dpy); /* avoid race conditions */
+--
+2.55.0
+