aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md19
-rw-r--r--config.def.h6
-rw-r--r--config.h6
-rw-r--r--dwm.c38
-rw-r--r--patches/dwm-preserveonrestart-6.3.diff118
5 files changed, 163 insertions, 24 deletions
diff --git a/README.md b/README.md
index 40eed4e..890d9f2 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,4 @@
-# DWM 6.5 window manager
-
-`git clone https://git.suckless.org/dwm`
-
-[suckless dwm](https://dwm.suckless.org/)
-
-This repos contains the following patches:
+# The DWM 6.5 window manager with the following patches:
- xrdb
- swallow
@@ -13,13 +7,4 @@ This repos contains the following patches:
- attachside
- removeborder
- deck
-
-Also included are AZERTY and ThinkPad key bindings
-
-### Snapshot
-
-[dwm-master.tar.gz](https://git.wittamore.com/dwm/snapshot/dwm-master.tar.gz)
-
-### Diff file
-
-A single diff file with these patches and modifications for dwm 6.5 is [here](https://git.wittamore.com/diffs/tree/dwm_6.5_240525.diff)
+- preserveonrestart
diff --git a/config.def.h b/config.def.h
index a9fbdb4..60f2834 100644
--- a/config.def.h
+++ b/config.def.h
@@ -71,7 +71,8 @@ static const Key keys[] = {
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_w, spawn, SHCMD("librewolf") },
- { MODKEY, XK_x, spawn, SHCMD("rofi -show power-menu -modi power-menu:rofi-power-menu") },
+ { MODKEY, XK_x, spawn, SHCMD("dmenu-power") },
+ { MODKEY, XK_v, spawn, SHCMD("dmenu-connect") },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
@@ -107,8 +108,7 @@ static const Key keys[] = {
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("dwm-audio mictoggle") },
{ 0, XF86XK_MonBrightnessDown, spawn, SHCMD("brightnessctl set 10%-") },
{ 0, XF86XK_MonBrightnessUp, spawn, SHCMD("brightnessctl set 10%+") },
- { 0, XF86XK_Launch1, spawn, SHCMD("dpower") },
- { 0, XK_Menu, spawn, SHCMD("dpower") },
+ { 0, XF86XK_Launch1, spawn, SHCMD("dmenu-power") },
{ 0, XK_Print, spawn, SHCMD("screenshot.sh") },
TAGKEYS( XK_ampersand, 0)
TAGKEYS( XK_eacute, 1)
diff --git a/config.h b/config.h
index a9fbdb4..60f2834 100644
--- a/config.h
+++ b/config.h
@@ -71,7 +71,8 @@ static const Key keys[] = {
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_w, spawn, SHCMD("librewolf") },
- { MODKEY, XK_x, spawn, SHCMD("rofi -show power-menu -modi power-menu:rofi-power-menu") },
+ { MODKEY, XK_x, spawn, SHCMD("dmenu-power") },
+ { MODKEY, XK_v, spawn, SHCMD("dmenu-connect") },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
@@ -107,8 +108,7 @@ static const Key keys[] = {
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("dwm-audio mictoggle") },
{ 0, XF86XK_MonBrightnessDown, spawn, SHCMD("brightnessctl set 10%-") },
{ 0, XF86XK_MonBrightnessUp, spawn, SHCMD("brightnessctl set 10%+") },
- { 0, XF86XK_Launch1, spawn, SHCMD("dpower") },
- { 0, XK_Menu, spawn, SHCMD("dpower") },
+ { 0, XF86XK_Launch1, spawn, SHCMD("dmenu-power") },
{ 0, XK_Print, spawn, SHCMD("screenshot.sh") },
TAGKEYS( XK_ampersand, 0)
TAGKEYS( XK_eacute, 1)
diff --git a/dwm.c b/dwm.c
index 39a5717..a05a200 100644
--- a/dwm.c
+++ b/dwm.c
@@ -84,7 +84,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, NetClientInfo, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
@@ -231,6 +231,7 @@ 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 setclienttagprop(Client *c);
static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen);
static void setlayout(const Arg *arg);
@@ -1259,6 +1260,26 @@ manage(Window w, XWindowAttributes *wa)
updatewindowtype(c);
updatesizehints(c);
updatewmhints(c);
+ {
+ int format;
+ unsigned long *data, n, extra;
+ Monitor *m;
+ Atom atom;
+ if (XGetWindowProperty(dpy, c->win, netatom[NetClientInfo], 0L, 2L, False, XA_CARDINAL,
+ &atom, &format, &n, &extra, (unsigned char **)&data) == Success && n == 2) {
+ c->tags = *data;
+ for (m = mons; m; m = m->next) {
+ if (m->num == *(data+1)) {
+ c->mon = m;
+ break;
+ }
+ }
+ }
+ if (n > 0)
+ XFree(data);
+ }
+ setclienttagprop(c);
+
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0);
if (!c->isfloating)
@@ -1692,6 +1713,7 @@ sendmon(Client *c, Monitor *m)
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
attachaside(c);
attachstack(c);
+ setclienttagprop(c);
focus(NULL);
arrange(NULL);
}
@@ -1842,6 +1864,7 @@ 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[NetClientInfo] = XInternAtom(dpy, "_NET_CLIENT_INFO", False);
/* init cursors */
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
@@ -1865,6 +1888,7 @@ setup(void)
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
PropModeReplace, (unsigned char *) netatom, NetLast);
XDeleteProperty(dpy, root, netatom[NetClientList]);
+ XDeleteProperty(dpy, root, netatom[NetClientInfo]);
/* select events */
wa.cursor = cursor[CurNormal]->cursor;
wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask
@@ -1930,10 +1954,21 @@ spawn(const Arg *arg)
}
void
+setclienttagprop(Client *c)
+{
+ long data[] = { (long) c->tags, (long) c->mon->num };
+ XChangeProperty(dpy, c->win, netatom[NetClientInfo], XA_CARDINAL, 32,
+ PropModeReplace, (unsigned char *) data, 2);
+}
+
+void
tag(const Arg *arg)
{
+ Client *c;
if (selmon->sel && arg->ui & TAGMASK) {
+ c = selmon->sel;
selmon->sel->tags = arg->ui & TAGMASK;
+ setclienttagprop(c);
focus(NULL);
arrange(selmon);
}
@@ -2034,6 +2069,7 @@ toggletag(const Arg *arg)
newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
if (newtags) {
selmon->sel->tags = newtags;
+ setclienttagprop(selmon->sel);
focus(NULL);
arrange(selmon);
}
diff --git a/patches/dwm-preserveonrestart-6.3.diff b/patches/dwm-preserveonrestart-6.3.diff
new file mode 100644
index 0000000..079cf05
--- /dev/null
+++ b/patches/dwm-preserveonrestart-6.3.diff
@@ -0,0 +1,118 @@
+From 713fa8650f5a20006451ebcccf57a4512e83bae8 Mon Sep 17 00:00:00 2001
+From: Arda Atci <arda@phytech.io>
+Date: Wed, 18 May 2022 17:23:16 +0300
+Subject: [PATCH] preserve clients on old tags when renewing dwm
+
+By default, when dwm is recompiled-restarted all clients will
+lose it's current tag and collapse to first tag. This patch preserves
+clients on old tags, however note that layout order is not preserved.
+
+---
+ dwm.c | 38 +++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 37 insertions(+), 1 deletion(-)
+
+diff --git a/dwm.c b/dwm.c
+index a96f33c..a12e0bd 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -62,7 +62,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, NetClientInfo, NetLast }; /* EWMH atoms */
+ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
+ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
+ ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
+@@ -198,6 +198,7 @@ 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 setclienttagprop(Client *c);
+ static void setfocus(Client *c);
+ static void setfullscreen(Client *c, int fullscreen);
+ static void setlayout(const Arg *arg);
+@@ -1060,6 +1061,26 @@ manage(Window w, XWindowAttributes *wa)
+ updatewindowtype(c);
+ updatesizehints(c);
+ updatewmhints(c);
++ {
++ int format;
++ unsigned long *data, n, extra;
++ Monitor *m;
++ Atom atom;
++ if (XGetWindowProperty(dpy, c->win, netatom[NetClientInfo], 0L, 2L, False, XA_CARDINAL,
++ &atom, &format, &n, &extra, (unsigned char **)&data) == Success && n == 2) {
++ c->tags = *data;
++ for (m = mons; m; m = m->next) {
++ if (m->num == *(data+1)) {
++ c->mon = m;
++ break;
++ }
++ }
++ }
++ if (n > 0)
++ XFree(data);
++ }
++ setclienttagprop(c);
++
+ XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
+ grabbuttons(c, 0);
+ if (!c->isfloating)
+@@ -1423,6 +1444,7 @@ sendmon(Client *c, Monitor *m)
+ c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
+ attach(c);
+ attachstack(c);
++ setclienttagprop(c);
+ focus(NULL);
+ arrange(NULL);
+ }
+@@ -1566,6 +1588,7 @@ 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[NetClientInfo] = XInternAtom(dpy, "_NET_CLIENT_INFO", False);
+ /* init cursors */
+ cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
+ cursor[CurResize] = drw_cur_create(drw, XC_sizing);
+@@ -1589,6 +1612,7 @@ setup(void)
+ XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
+ PropModeReplace, (unsigned char *) netatom, NetLast);
+ XDeleteProperty(dpy, root, netatom[NetClientList]);
++ XDeleteProperty(dpy, root, netatom[NetClientInfo]);
+ /* select events */
+ wa.cursor = cursor[CurNormal]->cursor;
+ wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask
+@@ -1656,11 +1680,22 @@ spawn(const Arg *arg)
+ }
+ }
+
++void
++setclienttagprop(Client *c)
++{
++ long data[] = { (long) c->tags, (long) c->mon->num };
++ XChangeProperty(dpy, c->win, netatom[NetClientInfo], XA_CARDINAL, 32,
++ PropModeReplace, (unsigned char *) data, 2);
++}
++
+ void
+ tag(const Arg *arg)
+ {
++ Client *c;
+ if (selmon->sel && arg->ui & TAGMASK) {
++ c = selmon->sel;
+ selmon->sel->tags = arg->ui & TAGMASK;
++ setclienttagprop(c);
+ focus(NULL);
+ arrange(selmon);
+ }
+@@ -1735,6 +1770,7 @@ toggletag(const Arg *arg)
+ newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
+ if (newtags) {
+ selmon->sel->tags = newtags;
++ setclienttagprop(selmon->sel);
+ focus(NULL);
+ arrange(selmon);
+ }
+--
+2.36.1