dwm-current_desktop-5.8.2.diff - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-current_desktop-5.8.2.diff (3607B) | |
--- | |
1 diff -r 23b71491e149 dwm.c | |
2 --- a/dwm.c Thu Dec 02 10:16:47 2010 +0000 | |
3 +++ b/dwm.c Mon Dec 13 08:18:03 2010 -0500 | |
4 @@ -57,8 +57,8 @@ | |
5 /* enums */ | |
6 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ | |
7 enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ | |
8 -enum { NetSupported, NetWMName, NetWMState, | |
9 - NetWMFullscreen, NetLast }; /* EWMH atoms */ | |
10 +enum { NetSupported, NetWMName, NetWMState, NetWMFullscreen, | |
11 + NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /* EWMH atoms */ | |
12 enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atom… | |
13 enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, | |
14 ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ | |
15 @@ -212,6 +212,7 @@ | |
16 static void setclientstate(Client *c, long state); | |
17 static void setlayout(const Arg *arg); | |
18 static void setmfact(const Arg *arg); | |
19 +static void setnumbdesktops(void); | |
20 static void setup(void); | |
21 static void showhide(Client *c); | |
22 static void sigchld(int unused); | |
23 @@ -227,6 +228,7 @@ | |
24 static void unfocus(Client *c, Bool setfocus); | |
25 static void unmanage(Client *c, Bool destroyed); | |
26 static void unmapnotify(XEvent *e); | |
27 +static void updatecurrenddesktop(void); | |
28 static Bool updategeom(void); | |
29 static void updatebarpos(Monitor *m); | |
30 static void updatebars(void); | |
31 @@ -1467,6 +1469,13 @@ | |
32 } | |
33 | |
34 void | |
35 +setcurrentdesktop(void){ | |
36 + long data[] = { 0 }; | |
37 + XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDI… | |
38 + PropModeReplace, (unsigned char *)data, 1); | |
39 +} | |
40 + | |
41 +void | |
42 setclientstate(Client *c, long state) { | |
43 long data[] = { state, None }; | |
44 | |
45 @@ -1502,6 +1511,13 @@ | |
46 } | |
47 | |
48 void | |
49 +setnumbdesktops(void){ | |
50 + long data[] = { TAGMASK }; | |
51 + XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CAR… | |
52 + PropModeReplace, (unsigned char *)data, 1); | |
53 +} | |
54 + | |
55 +void | |
56 setup(void) { | |
57 XSetWindowAttributes wa; | |
58 | |
59 @@ -1524,6 +1540,8 @@ | |
60 netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); | |
61 netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); | |
62 netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULL… | |
63 + netatom[NetNumberOfDesktops] = XInternAtom(dpy, "_NET_NUMBER_OF… | |
64 + netatom[NetCurrentDesktop] = XInternAtom(dpy, "_NET_CURRENT_DES… | |
65 /* init cursors */ | |
66 cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); | |
67 cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); | |
68 @@ -1546,6 +1564,10 @@ | |
69 /* EWMH support per view */ | |
70 XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, | |
71 PropModeReplace, (unsigned char *) netatom, Net… | |
72 + /* set EWMH NUMBER_OF_DESKTOPS */ | |
73 + setnumbdesktops(); | |
74 + /* initialize EWMH CURRENT_DESKTOP */ | |
75 + setcurrentdesktop(); | |
76 /* select for events */ | |
77 wa.cursor = cursor[CurNormal]; | |
78 wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask… | |
79 @@ -1688,6 +1710,7 @@ | |
80 selmon->tagset[selmon->seltags] = newtagset; | |
81 arrange(selmon); | |
82 } | |
83 + updatecurrenddesktop(); | |
84 } | |
85 | |
86 void | |
87 @@ -1763,6 +1786,14 @@ | |
88 m->by = -bh; | |
89 } | |
90 | |
91 +void | |
92 +updatecurrenddesktop(){ | |
93 + long data[] = { selmon->tagset[selmon->seltags] }; | |
94 + | |
95 + XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDI… | |
96 + PropModeReplace, (unsigned char *)data, 1); | |
97 +} | |
98 + | |
99 Bool | |
100 updategeom(void) { | |
101 Bool dirty = False; | |
102 @@ -1948,6 +1979,7 @@ | |
103 if(arg->ui & TAGMASK) | |
104 selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; | |
105 arrange(selmon); | |
106 + updatecurrenddesktop(); | |
107 } | |
108 | |
109 Client * |