commit 620f2471438412208f51b283b8ce08681589f23c
parent 4aa2d2900ac600584dd3e3c14ee13b14601fcbd5
Author: d8dr <d8dr@noreply.codeberg.org>
Date: Thu, 5 Mar 2026 22:18:24 +1000
add _NET_WM_DESKTOP property correctly
Diffstat:
3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/modules/ewmh_tags/ewmh_tags.c b/modules/ewmh_tags/ewmh_tags.c
@@ -32,3 +32,11 @@ updatecurrentdesktop(void){
long data[] = { i };
XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
}
+
+void
+updatewmdesktop(Client *c)
+{
+ unsigned long desktop = c->tags ? ffs(c->tags) - 1 : 0;
+ XChangeProperty(dpy, c->win, netatom[NetDesktopNum], XA_CARDINAL, 32,
+ PropModeReplace, (unsigned char *)&desktop, 1);
+}+
\ No newline at end of file
diff --git a/modules/ewmh_tags/ewmh_tags.h b/modules/ewmh_tags/ewmh_tags.h
@@ -5,3 +5,4 @@ static void setdesktopnames(void);
static void setnumdesktops(void);
static void setviewport(void);
static void updatecurrentdesktop(void);
+static void updatewmdesktop(Client *c);+
\ No newline at end of file
diff --git a/vxwm.c b/vxwm.c
@@ -98,7 +98,7 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
#if !EWMH_TAGS
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
#else //EWMH_TAGS
- NetWMWindowTypeDialog, NetClientList, NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /* EWMH atoms */
+ NetWMWindowTypeDialog, NetClientList, NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, NetDesktopNum, NetLast }; /* EWMH atoms */
#endif
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
@@ -1283,6 +1283,9 @@ manage(Window w, XWindowAttributes *wa)
XRaiseWindow(dpy, c->win);
attach(c);
attachstack(c);
+ #if EWMH_TAGS
+ updatewmdesktop(c);
+ #endif
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &(c->win), 1);
XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
@@ -1780,6 +1783,9 @@ sendmon(Client *c, Monitor *m)
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
attach(c);
attachstack(c);
+ #if EWMH_TAGS
+ updatewmdesktop(c);
+ #endif
focus(NULL);
arrange(NULL);
}
@@ -1964,6 +1970,7 @@ setup(void)
netatom[NetNumberOfDesktops] = XInternAtom(dpy, "_NET_NUMBER_OF_DESKTOPS", False);
netatom[NetCurrentDesktop] = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", False);
netatom[NetDesktopNames] = XInternAtom(dpy, "_NET_DESKTOP_NAMES", False);
+ netatom[NetDesktopNum] = XInternAtom(dpy, "_NET_WM_DESKTOP", False);
#endif
/* init cursors */
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
@@ -2119,6 +2126,9 @@ tag(const Arg *arg)
#endif
selmon->sel->tags = arg->ui & TAGMASK;
+ #if EWMH_TAGS
+ updatewmdesktop(selmon->sel);
+ #endif
focus(NULL);
arrange(selmon);
}
@@ -2214,6 +2224,9 @@ toggletag(const Arg *arg)
newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
if (newtags) {
selmon->sel->tags = newtags;
+ #if EWMH_TAGS
+ updatewmdesktop(selmon->sel);
+ #endif
focus(NULL);
arrange(selmon);
}