[wiki] [sites] wiki updated

From: <hg_AT_suckless.org>
Date: Mon, 13 Dec 2010 13:38:35 +0000 (UTC)

changeset: 660:7b26aa3e3fe9
tag: tip
user: Wolfgang E. Sanyer <ezzieyguywuf_AT_gmail.com>
date: Mon Dec 13 08:37:11 2010 -0500
files: dwm.suckless.org/patches/current_desktop.md dwm.suckless.org/patches/dwm-5.8.2-current_desktop.patch
description:
Added new patch to dwm site.

My md file provides a pretty thorough description of the patch. Feel free to
email with any questions.


diff -r e6f26b6184e9 -r 7b26aa3e3fe9 dwm.suckless.org/patches/current_desktop.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwm.suckless.org/patches/current_desktop.md Mon Dec 13 08:37:11 2010 -0500
_AT_@ -0,0 +1,30 @@
+# FOCUSONCLICK
+
+## Description
+
+ Sets _NET_NUMBER_OF_DESKTOPS and _NET_CURRENT_DESKTOP on root to appropriate
+ values. Note that 'appropriate' for these values don't make sense as xprop
+ -root output, since dwm uses them at bitwise but xprop displays them in base
+ ten. In other words, if you have 4 desktops, _NET_NUMBER_OF_DESKTOPS is actualy
+ 0b1111 but xprop displays this as 15. I'm ok with this, because the end-user
+ (program, script, w/e) can always parse this appropriately. The same goes for
+ _NET_CURRENT_DESKTOP: if you have desktops 1 and 3 selected, the value is
+ 0b1010, but xprop shows this as 10. This isn't a problem.
+
+ I should note that in this case, _NET_NUMBER_OF_DESKTOPS does not exactly
+ conform to EWMH specifications: in reality, there are many more 'desktops' than
+ 15 (in the above example), as any combination of 1, 2, 3 or 4 of the availables
+ tags can be considered one desktop. _CURRENT_DESKTOP will, however, always be
+ less that _NET_NUMBER_OF_DESKTOPS, so I'm happy with that.
+
+ I wrote this patch mainly for myself, as I have a script for tabbed that uses
+ it (I will upload this later). I am open to feedback/contstructive criticism.
+ Email is at the bottom.
+
+## Download
+
+ * [dwm-5.8.2-current_desktop.diff](dwm-5.8.2-current_desktop.diff) (dwm 2010604)
+
+## Author
+
+ * Wolfgang S. - ezzieyguywuf at gmail period com
diff -r e6f26b6184e9 -r 7b26aa3e3fe9 dwm.suckless.org/patches/dwm-5.8.2-current_desktop.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwm.suckless.org/patches/dwm-5.8.2-current_desktop.patch Mon Dec 13 08:37:11 2010 -0500
_AT_@ -0,0 +1,109 @@
+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
+_AT_@ -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 */
+_AT_@ -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);
+_AT_@ -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);
+_AT_@ -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 };
+
+_AT_@ -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;
+
+_AT_@ -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);
+_AT_@ -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
+_AT_@ -1688,6 +1710,7 @@
+ selmon->tagset[selmon->seltags] = newtagset;
+ arrange(selmon);
+ }
++ updatecurrenddesktop();
+ }
+
+ void
+_AT_@ -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;
+_AT_@ -1948,6 +1979,7 @@
+ if(arg->ui & TAGMASK)
+ selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
+ arrange(selmon);
++ updatecurrenddesktop();
+ }
+
+ Client *
Received on Mon Dec 13 2010 - 14:38:35 CET

This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 19:31:34 CEST