sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 6a1d4c4c4b4800d81c5130f33e2263d449739c58
parent ac47b5e382c93834bda7ac4fa76d2c66b5f56c16
Author: rangerlatham <ghanklatham@gmail.com>
Date:   Mon,  1 Jan 2018 16:07:14 -0500

created page for patch that adds ewmh support to dwm

Diffstat:
Adwm.suckless.org/patches/ewmhtags/dwm-ewmhtags-20180101-db22360.diff | 154+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/ewmhtags/dwm-ewmhtags-6.1.diff | 144+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/ewmhtags/index.md | 21+++++++++++++++++++++
3 files changed, 319 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/ewmhtags/dwm-ewmhtags-20180101-db22360.diff b/dwm.suckless.org/patches/ewmhtags/dwm-ewmhtags-20180101-db22360.diff @@ -0,0 +1,154 @@ +From 44ad1a9255504ef36670f46101689b2ab9d8501e Mon Sep 17 00:00:00 2001 +From: rangerlatham <ghanklatham@gmail.com> +Date: Sun, 31 Dec 2017 19:26:47 -0500 +Subject: [PATCH] patch that adds ewmh functionality to dwm. see + dwm.suckless.org/patches/ewmhtags for more details + +--- + dwm.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 47 insertions(+), 1 deletion(-) + +diff --git a/dwm.c b/dwm.c +index ec6a27c..018b7aa 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -55,6 +55,7 @@ + #define WIDTH(X) ((X)->w + 2 * (X)->bw) + #define HEIGHT(X) ((X)->h + 2 * (X)->bw) + #define TAGMASK ((1 << LENGTH(tags)) - 1) ++#define TAGSLENGTH (LENGTH(tags)) + #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) + #define ColBorder 2 + +@@ -63,7 +64,7 @@ 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, NetClientList, NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /* EWMH atoms */ + enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ + enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, + ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ +@@ -198,11 +199,15 @@ static void scan(void); + static int sendevent(Client *c, Atom proto); + static void sendmon(Client *c, Monitor *m); + static void setclientstate(Client *c, long state); ++static void setcurrentdesktop(void); ++static void setdesktopnames(void); + static void setfocus(Client *c); + static void setfullscreen(Client *c, int fullscreen); + static void setlayout(const Arg *arg); + static void setmfact(const Arg *arg); ++static void setnumdesktops(void); + static void setup(void); ++static void setviewport(void); + static void seturgent(Client *c, int urg); + static void showhide(Client *c); + static void sigchld(int unused); +@@ -217,6 +222,7 @@ static void toggleview(const Arg *arg); + static void unfocus(Client *c, int setfocus); + static void unmanage(Client *c, int destroyed); + static void unmapnotify(XEvent *e); ++static void updatecurrentdesktop(void); + static int updategeom(void); + static void updatebarpos(Monitor *m); + static void updatebars(void); +@@ -1432,6 +1438,16 @@ setclientstate(Client *c, long state) + XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32, + PropModeReplace, (unsigned char *)data, 2); + } ++void ++setcurrentdesktop(void){ ++ long data[] = { 0 }; ++ XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1); ++} ++void setdesktopnames(void){ ++ XTextProperty text; ++ Xutf8TextListToTextProperty(dpy, tags, TAGSLENGTH, XUTF8StringStyle, &text); ++ XSetTextProperty(dpy, root, &text, netatom[NetDesktopNames]); ++} + + int + sendevent(Client *c, Atom proto) +@@ -1527,6 +1543,12 @@ setmfact(const Arg *arg) + arrange(selmon); + } + ++void ++setnumdesktops(void){ ++ long data[] = { TAGSLENGTH }; ++ XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1); ++} ++ + void + setup(void) + { +@@ -1563,6 +1585,10 @@ setup(void) + netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); + netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); + netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); ++ netatom[NetDesktopViewport] = XInternAtom(dpy, "_NET_DESKTOP_VIEWPORT", False); ++ 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); + /* init cursors */ + cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); + cursor[CurResize] = drw_cur_create(drw, XC_sizing); +@@ -1585,6 +1611,10 @@ setup(void) + /* EWMH support per view */ + XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, + PropModeReplace, (unsigned char *) netatom, NetLast); ++ setnumdesktops(); ++ setcurrentdesktop(); ++ setdesktopnames(); ++ setviewport(); + XDeleteProperty(dpy, root, netatom[NetClientList]); + /* select events */ + wa.cursor = cursor[CurNormal]->cursor; +@@ -1596,6 +1626,11 @@ setup(void) + grabkeys(); + focus(NULL); + } ++void ++setviewport(void){ ++ long data[] = { 0, 0 }; ++ XChangeProperty(dpy, root, netatom[NetDesktopViewport], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 2); ++} + + + void +@@ -1745,6 +1780,7 @@ toggleview(const Arg *arg) + focus(NULL); + arrange(selmon); + } ++ updatecurrentdesktop(); + } + + void +@@ -1847,6 +1883,15 @@ updateclientlist() + XA_WINDOW, 32, PropModeAppend, + (unsigned char *) &(c->win), 1); + } ++void updatecurrentdesktop(void){ ++ long rawdata[] = { selmon->tagset[selmon->seltags] }; ++ int i=0; ++ while(*rawdata >> i+1){ ++ i++; ++ } ++ long data[] = { i }; ++ XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1); ++} + + int + updategeom(void) +@@ -2043,6 +2088,7 @@ view(const Arg *arg) + selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; + focus(NULL); + arrange(selmon); ++ updatecurrentdesktop(); + } + + Client * +-- +2.15.1 + diff --git a/dwm.suckless.org/patches/ewmhtags/dwm-ewmhtags-6.1.diff b/dwm.suckless.org/patches/ewmhtags/dwm-ewmhtags-6.1.diff @@ -0,0 +1,144 @@ +diff -up dwm-6.1/dwm.c dwm-modified/dwm.c +--- dwm-6.1/dwm.c 2015-11-08 17:39:37.000000000 -0500 ++++ dwm-modified/dwm.c 2017-12-31 16:54:23.549914920 -0500 +@@ -55,6 +55,7 @@ + #define WIDTH(X) ((X)->w + 2 * (X)->bw) + #define HEIGHT(X) ((X)->h + 2 * (X)->bw) + #define TAGMASK ((1 << LENGTH(tags)) - 1) ++#define TAGSLENGTH (LENGTH(tags)) + #define TEXTW(X) (drw_text(drw, 0, 0, 0, 0, (X), 0) + drw->fonts[0]->h) + + /* enums */ +@@ -62,7 +63,7 @@ enum { CurNormal, CurResize, CurMove, Cu + enum { SchemeNorm, SchemeSel, SchemeLast }; /* color schemes */ + enum { NetSupported, NetWMName, NetWMState, + NetWMFullscreen, NetActiveWindow, NetWMWindowType, +- NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ ++ NetWMWindowTypeDialog, NetClientList, NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /* EWMH atoms */ + enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ + enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, + ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ +@@ -198,11 +199,15 @@ static void scan(void); + static int sendevent(Client *c, Atom proto); + static void sendmon(Client *c, Monitor *m); + static void setclientstate(Client *c, long state); ++static void setcurrentdesktop(void); ++static void setdesktopnames(void); + static void setfocus(Client *c); + static void setfullscreen(Client *c, int fullscreen); + static void setlayout(const Arg *arg); + static void setmfact(const Arg *arg); ++static void setnumdesktops(void); + static void setup(void); ++static void setviewport(void); + static void showhide(Client *c); + static void sigchld(int unused); + static void spawn(const Arg *arg); +@@ -216,6 +221,7 @@ static void toggleview(const Arg *arg); + static void unfocus(Client *c, int setfocus); + static void unmanage(Client *c, int destroyed); + static void unmapnotify(XEvent *e); ++static void updatecurrentdesktop(void); + static int updategeom(void); + static void updatebarpos(Monitor *m); + static void updatebars(void); +@@ -1448,6 +1454,18 @@ setclientstate(Client *c, long state) + XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32, + PropModeReplace, (unsigned char *)data, 2); + } ++void ++setcurrentdesktop(void){ ++ long data[] = { 0 }; ++ XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1); ++} ++ ++void ++setdesktopnames(void){ ++ XTextProperty text; ++ Xutf8TextListToTextProperty(dpy, tags, TAGSLENGTH, XUTF8StringStyle, &text); ++ XSetTextProperty(dpy, root, &text, netatom[NetDesktopNames]); ++} + + int + sendevent(Client *c, Atom proto) +@@ -1542,6 +1560,11 @@ setmfact(const Arg *arg) + selmon->mfact = f; + arrange(selmon); + } ++void ++setnumdesktops(void){ ++ long data[] = { TAGSLENGTH }; ++ XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1); ++} + + void + setup(void) +@@ -1575,6 +1598,10 @@ setup(void) + netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); + netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); + netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); ++ netatom[NetDesktopViewport] = XInternAtom(dpy, "_NET_DESKTOP_VIEWPORT", False); ++ 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); + /* init cursors */ + cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); + cursor[CurResize] = drw_cur_create(drw, XC_sizing); +@@ -1592,6 +1619,10 @@ setup(void) + /* EWMH support per view */ + XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, + PropModeReplace, (unsigned char *) netatom, NetLast); ++ setnumdesktops(); ++ setcurrentdesktop(); ++ setdesktopnames(); ++ setviewport(); + XDeleteProperty(dpy, root, netatom[NetClientList]); + /* select for events */ + wa.cursor = cursor[CurNormal]->cursor; +@@ -1604,6 +1635,12 @@ setup(void) + } + + void ++setviewport(void){ ++ long data[] = { 0, 0 }; ++ XChangeProperty(dpy, root, netatom[NetDesktopViewport], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 2); ++} ++ ++void + showhide(Client *c) + { + if (!c) +@@ -1737,6 +1774,7 @@ toggleview(const Arg *arg) + focus(NULL); + arrange(selmon); + } ++ updatecurrentdesktop(); + } + + void +@@ -1839,6 +1877,17 @@ updateclientlist() + (unsigned char *) &(c->win), 1); + } + ++void ++updatecurrentdesktop(void){ ++ long rawdata[] = { selmon->tagset[selmon->seltags] }; ++ int i=0; ++ while(*rawdata >> i+1){ ++ i++; ++ } ++ long data[] = { i }; ++ XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1); ++} ++ + int + updategeom(void) + { +@@ -2038,6 +2087,7 @@ view(const Arg *arg) + selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; + focus(NULL); + arrange(selmon); ++ updatecurrentdesktop(); + } + + Client * diff --git a/dwm.suckless.org/patches/ewmhtags/index.md b/dwm.suckless.org/patches/ewmhtags/index.md @@ -0,0 +1,21 @@ +ewmhtags +====== + +Description +----------- +a 6.1 update and extension to [current desktop][1]. +adds EWMH support for \_NET\_NUMBER\_OF\_DESKTOPS, \_NET\_CURRENT\_DESKTOP, \_NET\_DESKTOP\_NAMES, +and \_NET\_DESKTOP\_VIEWPORT, which allows for compatibility with other bars and programs that request workspace information. +for example, [polybar's][2] xworkspaces module + +Download +-------- + * [dwm-ewmhtags-6.1.diff](dwm-ewmhtags-6.1.diff) + * [dwm-ewmhtags-20180101-db22360.diff](dwm-ewmhtags-20180101-db22360.diff) + +Authors +------- + * Hank Latham - `<hank at hanklatham dot net>` + +[1]: ../current_desktop +[2]: http://github.com/jaagr/polybar