diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-06-09 17:16:46 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-06-09 17:16:46 +0200 |
commit | d85ac2a39e477c4151ef1404b5204231f6ef5c2c (patch) | |
tree | b8e4d46d57afb8f6edc0249ab04b02c653970453 | |
parent | c5bb7db6bbd0beba0dbdc98cd60cb0d3ea69e7c2 (diff) | |
download | dwm-d85ac2a39e477c4151ef1404b5204231f6ef5c2c.tar.gz dwm-d85ac2a39e477c4151ef1404b5204231f6ef5c2c.tar.bz2 dwm-d85ac2a39e477c4151ef1404b5204231f6ef5c2c.zip |
update
-rw-r--r-- | config.def.h | 15 | ||||
-rw-r--r-- | config.h | 9 | ||||
-rw-r--r-- | dwm.c | 51 | ||||
-rw-r--r-- | patches/dwm-ewmhtags-6.2.diff | 161 |
4 files changed, 224 insertions, 12 deletions
diff --git a/config.def.h b/config.def.h index 2dfba63..1b5af34 100644 --- a/config.def.h +++ b/config.def.h @@ -7,7 +7,7 @@ static const unsigned int snap = 32; /* snap pixel */ static const int swallowfloating = 0; /* 1 means swallow floating windows by default */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ -static const char *fonts[] = { "Iosevka Nerd Font Regular:size=11","JoyPixels:pixelsize=10:antialias=true:autohint=true" }; +static const char *fonts[] = { "Iosevka Nerd Font Regular:size=11","JoyPixels:pixelsize=12:antialias=true:autohint=true" }; static const char dmenufont[] = "Iosevka Nerd Font Mono:size=11"; static char normbgcolor[] = "#222222"; static char normbordercolor[] = "#444444"; @@ -22,7 +22,7 @@ static char *colors[][3] = { }; /* tagging */ -static const char *tags[] = { "1" ,"2", "3", "4", "5", "6", "7", "8", "9" }; +static char *tags[] = { "1" ,"2", "3", "4", "5", "6", "7", "8", "9" }; static const Rule rules[] = { /* xprop(1): @@ -32,8 +32,8 @@ static const Rule rules[] = { /* class instance title tags mask iscentered isfloating isterminal noswallow monitor */ { "Gimp", NULL, NULL, 0, 0, 1, 0, 0, -1 }, { "Librewolf", NULL, NULL, 1 << 8, 0, 0, 0, 0, -1 }, - { "Kitty", NULL, NULL, 0, 0, 0, 1, 0, -1 }, - { "Orage", NULL, NULL, 0, 0, 1, 0, 1, -1 }, + { "Kitty", NULL, NULL, 0, 0, 0, 1, 0, -1 }, + { "Orage", NULL, NULL, 0, 1, 1, 0, 1, -1 }, { NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, -1 }, /* xev */ }; @@ -73,9 +73,10 @@ static const Key keys[] = { /* modifier key function argument */ { MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY, XK_Return, spawn, {.v = termcmd } }, - { MODKEY, XK_w, spawn, SHCMD("librewolf") }, + { MODKEY, XK_BackSpace, spawn, SHCMD("librewolf") }, { MODKEY, XK_x, spawn, SHCMD("dmenu-power") }, - { MODKEY, XK_s, spawn, SHCMD("dmenu-audio") }, + { MODKEY, XK_a, spawn, SHCMD("dmenu-audio") }, + { MODKEY, XK_s, spawn, SHCMD("dmenu-system") }, { MODKEY, XK_d, incnmaster, {.i = -1 } }, { MODKEY, XK_i, incnmaster, {.i = +1 } }, { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, @@ -112,7 +113,7 @@ static const Key keys[] = { { 0, XF86XK_MonBrightnessDown, spawn, SHCMD("brightnessctl set 10%-") }, { 0, XF86XK_MonBrightnessUp, spawn, SHCMD("brightnessctl set 10%+") }, { 0, XF86XK_Launch1, spawn, SHCMD("dmenu-power") }, - { 0, XK_Print, spawn, SHCMD("screenshot") }, + { 0, XK_Print, spawn, SHCMD("dwm-screenshot") }, TAGKEYS( XK_ampersand, 0) TAGKEYS( XK_eacute, 1) TAGKEYS( XK_quotedbl, 2) @@ -22,7 +22,7 @@ static char *colors[][3] = { }; /* tagging */ -static const char *tags[] = { "1" ,"2", "3", "4", "5", "6", "7", "8", "9" }; +static char *tags[] = { "1" ,"2", "3", "4", "5", "6", "7", "8", "9" }; static const Rule rules[] = { /* xprop(1): @@ -73,9 +73,10 @@ static const Key keys[] = { /* modifier key function argument */ { MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY, XK_Return, spawn, {.v = termcmd } }, - { MODKEY, XK_w, spawn, SHCMD("librewolf") }, + { MODKEY, XK_BackSpace, spawn, SHCMD("librewolf") }, { MODKEY, XK_x, spawn, SHCMD("dmenu-power") }, - { MODKEY, XK_s, spawn, SHCMD("dmenu-audio") }, + { MODKEY, XK_a, spawn, SHCMD("dmenu-audio") }, + { MODKEY, XK_s, spawn, SHCMD("dmenu-system") }, { MODKEY, XK_d, incnmaster, {.i = -1 } }, { MODKEY, XK_i, incnmaster, {.i = +1 } }, { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, @@ -112,7 +113,7 @@ static const Key keys[] = { { 0, XF86XK_MonBrightnessDown, spawn, SHCMD("brightnessctl set 10%-") }, { 0, XF86XK_MonBrightnessUp, spawn, SHCMD("brightnessctl set 10%+") }, { 0, XF86XK_Launch1, spawn, SHCMD("dmenu-power") }, - { 0, XK_Print, spawn, SHCMD("screenshot") }, + { 0, XK_Print, spawn, SHCMD("dwm-screenshot") }, TAGKEYS( XK_ampersand, 0) TAGKEYS( XK_eacute, 1) TAGKEYS( XK_quotedbl, 2) @@ -62,6 +62,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 XRDB_LOAD_COLOR(R,V) if (XrmGetResource(xrdb, R, NULL, &type, &value) == True) { \ if (value.addr != NULL && strnlen(value.addr, 8) == 7 && value.addr[0] == '#') { \ @@ -84,7 +85,8 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { SchemeNorm, SchemeSel }; /* color schemes */ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, NetWMFullscreen, NetActiveWindow, NetWMWindowType, - NetWMWindowTypeDialog, NetClientList, NetClientInfo, NetLast }; /* EWMH atoms */ + NetWMWindowTypeDialog, NetClientList, NetClientInfo, NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /* EWMH atoms */ + enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ @@ -233,12 +235,16 @@ 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 setclienttagprop(Client *c); 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 sigstatusbar(const Arg *arg); @@ -253,6 +259,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 void updatebarpos(Monitor *m); static void updatebars(void); static void updateclientlist(void); @@ -1801,6 +1808,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) @@ -1828,6 +1845,12 @@ sendevent(Client *c, Atom proto) } void +setnumdesktops(void){ + long data[] = { TAGSLENGTH }; + XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1); +} + +void setfocus(Client *c) { if (!c->neverfocus) { @@ -1940,6 +1963,11 @@ setup(void) netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); netatom[NetClientInfo] = XInternAtom(dpy, "_NET_CLIENT_INFO", 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); @@ -1962,6 +1990,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]); XDeleteProperty(dpy, root, netatom[NetClientInfo]); /* select events */ @@ -1974,6 +2006,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 seturgent(Client *c, int urg) @@ -2061,6 +2098,7 @@ tag(const Arg *arg) focus(NULL); arrange(selmon); } + updatecurrentdesktop(); } void @@ -2162,6 +2200,7 @@ toggletag(const Arg *arg) focus(NULL); arrange(selmon); } + updatecurrentdesktop(); } void @@ -2294,6 +2333,15 @@ updateclientlist(void) 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) @@ -2510,6 +2558,7 @@ view(const Arg *arg) selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; focus(NULL); arrange(selmon); + updatecurrentdesktop(); } pid_t diff --git a/patches/dwm-ewmhtags-6.2.diff b/patches/dwm-ewmhtags-6.2.diff new file mode 100644 index 0000000..32abb8c --- /dev/null +++ b/patches/dwm-ewmhtags-6.2.diff @@ -0,0 +1,161 @@ +From e5f0eefa921e6bad1e6f75faced0c3ae519995b3 Mon Sep 17 00:00:00 2001 +From: Ryan Kes <alrayyes@gmail.com> +Date: Thu, 28 Mar 2019 14:49:28 +0100 +Subject: [PATCH] dwm-ewhmtags-6.2 + +--- + dwm.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 48 insertions(+), 1 deletion(-) + +diff --git a/dwm.c b/dwm.c +index 4465af1..92022a1 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) + + /* enums */ +@@ -62,7 +63,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 */ +@@ -197,11 +198,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); +@@ -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 void updatebarpos(Monitor *m); + static void updatebars(void); + static void updateclientlist(void); +@@ -1431,6 +1437,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) +@@ -1457,6 +1473,12 @@ sendevent(Client *c, Atom proto) + return exists; + } + ++void ++setnumdesktops(void){ ++ long data[] = { TAGSLENGTH }; ++ XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1); ++} ++ + void + setfocus(Client *c) + { +@@ -1562,6 +1584,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); +@@ -1584,6 +1610,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; +@@ -1595,6 +1625,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 +@@ -1732,6 +1767,7 @@ toggletag(const Arg *arg) + focus(NULL); + arrange(selmon); + } ++ updatecurrentdesktop(); + } + + void +@@ -1744,6 +1780,7 @@ toggleview(const Arg *arg) + focus(NULL); + arrange(selmon); + } ++ updatecurrentdesktop(); + } + + void +@@ -1846,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) +@@ -2042,6 +2088,7 @@ view(const Arg *arg) + selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; + focus(NULL); + arrange(selmon); ++ updatecurrentdesktop(); + } + + Client * +-- +2.21.0 + |