diff -r 23b71491e149 dwm.c --- a/dwm.c Thu Dec 02 10:16:47 2010 +0000 +++ b/dwm.c Mon Dec 13 08:18:03 2010 -0500 @@ -57,8 +57,8 @@ /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ -enum { NetSupported, NetWMName, NetWMState, - NetWMFullscreen, NetLast }; /* EWMH atoms */ +enum { NetSupported, NetWMName, NetWMState, NetWMFullscreen, + NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /* EWMH atoms */ enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ @@ -212,6 +212,7 @@ static void setclientstate(Client *c, long state); static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); +static void setnumbdesktops(void); static void setup(void); static void showhide(Client *c); static void sigchld(int unused); @@ -227,6 +228,7 @@ static void unfocus(Client *c, Bool setfocus); static void unmanage(Client *c, Bool destroyed); static void unmapnotify(XEvent *e); +static void updatecurrenddesktop(void); static Bool updategeom(void); static void updatebarpos(Monitor *m); static void updatebars(void); @@ -1467,6 +1469,13 @@ } void +setcurrentdesktop(void){ + long data[] = { 0 }; + XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, + PropModeReplace, (unsigned char *)data, 1); +} + +void setclientstate(Client *c, long state) { long data[] = { state, None }; @@ -1502,6 +1511,13 @@ } void +setnumbdesktops(void){ + long data[] = { TAGMASK }; + XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32, + PropModeReplace, (unsigned char *)data, 1); +} + +void setup(void) { XSetWindowAttributes wa; @@ -1524,6 +1540,8 @@ netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); + netatom[NetNumberOfDesktops] = XInternAtom(dpy, "_NET_NUMBER_OF_DESKTOPS", False); + netatom[NetCurrentDesktop] = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", False); /* init cursors */ cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); @@ -1546,6 +1564,10 @@ /* EWMH support per view */ XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, PropModeReplace, (unsigned char *) netatom, NetLast); + /* set EWMH NUMBER_OF_DESKTOPS */ + setnumbdesktops(); + /* initialize EWMH CURRENT_DESKTOP */ + setcurrentdesktop(); /* select for events */ wa.cursor = cursor[CurNormal]; wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask @@ -1688,6 +1710,7 @@ selmon->tagset[selmon->seltags] = newtagset; arrange(selmon); } + updatecurrenddesktop(); } void @@ -1763,6 +1786,14 @@ m->by = -bh; } +void +updatecurrenddesktop(){ + long data[] = { selmon->tagset[selmon->seltags] }; + + XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, + PropModeReplace, (unsigned char *)data, 1); +} + Bool updategeom(void) { Bool dirty = False; @@ -1948,6 +1979,7 @@ if(arg->ui & TAGMASK) selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; arrange(selmon); + updatecurrenddesktop(); } Client *