[hackers] [dwm][PATCH] make ewmh notification and modal/sticky/skiptaskbar windows float

From: Bang Lee <qusicx_AT_gmail.com>
Date: Thu, 22 May 2025 16:57:46 -0700

Semantically or at least heuristically, these windows are meant to be
floating as well.
Based on my testing, NetWMStateModal and NetWMWindowTypeDialog seem to
be overlapping so I guess we can ignore WindowType and check State
only. Any feedback is appreciated. Thanks!
---
 dwm.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/dwm.c b/dwm.c
index 1443802..369627d 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -61,7 +61,8 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
 enum { SchemeNorm, SchemeSel }; /* color schemes */
 enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
        NetWMFullscreen, NetActiveWindow, NetWMWindowType,
-       NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
+       NetWMWindowTypeDialog, NetWMWindowTypeNotification, NetClientList,
+       NetWMStateModal, NetWMStateSticky, NetWMStateSkipTaskbar,
NetLast }; /* EWMH atoms */
 enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /*
default atoms */
 enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
        ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
_AT_@ -1577,7 +1578,11 @@ setup(void)
  netatom[NetWMFullscreen] = XInternAtom(dpy,
"_NET_WM_STATE_FULLSCREEN", False);
  netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
  netatom[NetWMWindowTypeDialog] = XInternAtom(dpy,
"_NET_WM_WINDOW_TYPE_DIALOG", False);
+ netatom[NetWMWindowTypeNotification] = XInternAtom(dpy,
"_NET_WM_WINDOW_TYPE_NOTIFICATION", False);
  netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
+ netatom[NetWMStateModal] = XInternAtom(dpy, "_NET_WM_STATE_MODAL", False);
+ netatom[NetWMStateSticky] = XInternAtom(dpy, "_NET_WM_STATE_STICKY", False);
+ netatom[NetWMStateSkipTaskbar] = XInternAtom(dpy,
"_NET_WM_STATE_SKIP_TASKBAR", False);
  /* init cursors */
  cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
  cursor[CurResize] = drw_cur_create(drw, XC_sizing);
_AT_@ -2026,7 +2031,11 @@ updatewindowtype(Client *c)
  if (state == netatom[NetWMFullscreen])
  setfullscreen(c, 1);
- if (wtype == netatom[NetWMWindowTypeDialog])
+ if (wtype == netatom[NetWMWindowTypeDialog]
+ || wtype == netatom[NetWMWindowTypeNotification]
+ || state == netatom[NetWMStateModal]
+ || state == netatom[NetWMStateSticky]
+ || state == netatom[NetWMStateSkipTaskbar])
  c->isfloating = 1;
 }
-- 
2.49.0
Received on Fri May 23 2025 - 01:57:46 CEST

This archive was generated by hypermail 2.3.0 : Fri May 23 2025 - 02:36:37 CEST