From f2cf00f4c9c076da9c950148f885b54d12e6d6d7 Mon Sep 17 00:00:00 2001 From: Philip Wittamore Date: Wed, 28 May 2025 14:21:21 +0200 Subject: update --- README.md | 2 + dwm_6.5_240525.diff | 959 ---------------------------------------------- patch-dwm-280525 | 1049 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1051 insertions(+), 959 deletions(-) delete mode 100644 dwm_6.5_240525.diff create mode 100644 patch-dwm-280525 diff --git a/README.md b/README.md index aca27e4..30f40c2 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ ## My diff files + + diff --git a/dwm_6.5_240525.diff b/dwm_6.5_240525.diff deleted file mode 100644 index 81aee62..0000000 --- a/dwm_6.5_240525.diff +++ /dev/null @@ -1,959 +0,0 @@ -diff -r -u a/dwm/config.def.h b/dwm/config.def.h ---- a/dwm/config.def.h 2025-05-19 09:47:15.538090711 +0200 -+++ b/dwm/config.def.h 2025-05-23 09:43:25.178507493 +0200 -@@ -1,34 +1,39 @@ - /* See LICENSE file for copyright and license details. */ -+#include - - /* appearance */ - static const unsigned int borderpx = 1; /* border pixel of windows */ - 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[] = { "monospace:size=10" }; --static const char dmenufont[] = "monospace:size=10"; --static const char col_gray1[] = "#222222"; --static const char col_gray2[] = "#444444"; --static const char col_gray3[] = "#bbbbbb"; --static const char col_gray4[] = "#eeeeee"; --static const char col_cyan[] = "#005577"; --static const char *colors[][3] = { -- /* fg bg border */ -- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, -- [SchemeSel] = { col_gray4, col_cyan, col_cyan }, -+static const char *fonts[] = { "JetBrainsMono Nerd Font Mono:size=11" }; -+static const char dmenufont[] = "JetBrainsMono Nerd Font Mono:size=11"; -+static char normbgcolor[] = "#222222"; -+static char normbordercolor[] = "#444444"; -+static char normfgcolor[] = "#bbbbbb"; -+static char selfgcolor[] = "#eeeeee"; -+static char selbordercolor[] = "#005577"; -+static char selbgcolor[] = "#005577"; -+static char *colors[][3] = { -+ /* fg bg border */ -+ [SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor }, -+ [SchemeSel] = { selfgcolor, selbgcolor, selbordercolor }, - }; - - /* tagging */ --static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; -+static const char *tags[] = { "Ⅰ" ,"Ⅱ", "Ⅲ", "Ⅳ"}; //, "5", "6", "7", "8", "9" }; - - static const Rule rules[] = { - /* xprop(1): - * WM_CLASS(STRING) = instance, class - * WM_NAME(STRING) = title - */ -- /* class instance title tags mask isfloating monitor */ -- { "Gimp", NULL, NULL, 0, 1, -1 }, -- { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, -+ /* class instance title tags mask isfloating isterminal noswallow monitor */ -+ { "Gimp", NULL, NULL, 0, 1, 0, 0, -1 }, -+ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1, -1 }, -+ { "Ghostty", NULL, NULL, 0, 0, 1, 0, -1 }, -+ { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */ - }; - - /* layout(s) */ -@@ -39,13 +44,14 @@ - - static const Layout layouts[] = { - /* symbol arrange function */ -- { "[]=", tile }, /* first entry is default */ -- { "><>", NULL }, /* no layout function means floating behavior */ -- { "[M]", monocle }, -+ { "[Ƭ]", tile }, /* first entry is default */ -+ { "[Φ]", NULL }, /* no layout function means floating behavior */ -+ { "[µ]", monocle }, /* everything is maximised */ -+ { "[D]", deck }, /* client windows superimposed */ - }; - - /* key definitions */ --#define MODKEY Mod1Mask -+#define MODKEY Mod4Mask - #define TAGKEYS(KEY,TAG) \ - { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ -@@ -57,44 +63,63 @@ - - /* commands */ - static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ --static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; --static const char *termcmd[] = { "st", NULL }; -+static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; -+static const char *termcmd[] = { "ghostty", NULL }; - - static const Key keys[] = { - /* modifier key function argument */ - { MODKEY, XK_p, spawn, {.v = dmenucmd } }, -- { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, -- { MODKEY, XK_b, togglebar, {0} }, -- { MODKEY, XK_j, focusstack, {.i = +1 } }, -- { MODKEY, XK_k, focusstack, {.i = -1 } }, -- { MODKEY, XK_i, incna, {.i = +1 } }, -+ { 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_d, incna, {.i = -1 } }, -- { MODKEY, XK_h, setmfact, {.f = -0.05} }, -- { MODKEY, XK_l, setmfact, {.f = +0.05} }, -- { MODKEY, XK_Return, zoom, {0} }, -- { MODKEY, XK_Tab, view, {0} }, -- { MODKEY|ShiftMask, XK_c, killclient, {0} }, -+ { MODKEY, XK_i, incna, {.i = +1 } }, - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, -+ { MODKEY, XK_r, setlayout, {.v = &layouts[3]} }, -+ { MODKEY, XK_h, setmfact, {.f = -0.05} }, -+ { MODKEY, XK_l, setmfact, {.f = +0.05} }, -+ { MODKEY, XK_comma, focusmon, {.i = -1 } }, -+ { MODKEY, XK_semicolon, focusmon, {.i = +1 } }, -+ { MODKEY, XK_F5, xrdb, {.v = NULL } }, -+ { MODKEY, XK_b, togglebar, {0} }, -+ { MODKEY, XK_Tab, view, {0} }, - { MODKEY, XK_space, setlayout, {0} }, -+ { MODKEY, XK_z, zoom, {0} }, -+ { MODKEY, XK_c, killclient, {0} }, -+ { MODKEY, XK_Right, viewnext, {0} }, -+ { MODKEY, XK_Left, viewprev, {0} }, -+ { MODKEY|ShiftMask, XK_Right, tagtonext, {0} }, -+ { MODKEY|ShiftMask, XK_Left, tagtoprev, {0} }, -+ { MODKEY|ControlMask, XK_Right, focusstack, {.i = +1 } }, -+ { MODKEY|ControlMask, XK_Left, focusstack, {.i = -1 } }, -+ { MODKEY|ShiftMask, XK_Up, rotatestack, {.i = +1 } }, -+ { MODKEY|ShiftMask, XK_Down, rotatestack, {.i = -1 } }, -+ { MODKEY|ShiftMask, XK_q, quit, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, -- { MODKEY, XK_0, view, {.ui = ~0 } }, -- { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, -- { MODKEY, XK_comma, focusmon, {.i = -1 } }, -- { MODKEY, XK_period, focusmon, {.i = +1 } }, -+ { MODKEY|ShiftMask, XK_agrave, tag, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, -- { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, -- TAGKEYS( XK_1, 0) -- TAGKEYS( XK_2, 1) -- TAGKEYS( XK_3, 2) -- TAGKEYS( XK_4, 3) -- TAGKEYS( XK_5, 4) -- TAGKEYS( XK_6, 5) -- TAGKEYS( XK_7, 6) -- TAGKEYS( XK_8, 7) -- TAGKEYS( XK_9, 8) -- { MODKEY|ShiftMask, XK_q, quit, {0} }, -+ { MODKEY|ShiftMask, XK_semicolon, tagmon, {.i = +1 } }, -+ { 0, XF86XK_AudioMute, spawn, SHCMD("dwm-audio voltoggle") }, -+ { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("dwm-audio volquieter") }, -+ { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("dwm-audio vollouder") }, -+ { 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, XK_Print, spawn, SHCMD("screenshot.sh") }, -+ TAGKEYS( XK_ampersand, 0) -+ TAGKEYS( XK_eacute, 1) -+ TAGKEYS( XK_quotedbl, 2) -+ TAGKEYS( XK_apostrophe, 3) -+ TAGKEYS( XK_parenleft, 4) -+ TAGKEYS( XK_minus, 5) -+ TAGKEYS( XK_egrave, 6) -+ TAGKEYS( XK_underscore, 7) -+ TAGKEYS( XK_ccedilla, 8) -+ TAGKEYS( XK_agrave, 9) - }; - - /* button definitions */ -Only in b/dwm/: config.h -diff -r -u a/dwm/config.mk b/dwm/config.mk ---- a/dwm/config.mk 2025-05-19 09:47:15.538090711 +0200 -+++ b/dwm/config.mk 2025-05-23 09:43:25.178507493 +0200 -@@ -20,10 +20,11 @@ - # OpenBSD (uncomment) - #FREETYPEINC = ${X11INC}/freetype2 - #MANPREFIX = ${PREFIX}/man -+#KVMLIB = -lkvm - - # includes and libs - INCS = -I${X11INC} -I${FREETYPEINC} --LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res ${KVMLIB} - - # flags - CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} -diff -r -u a/dwm/drw.c b/dwm/drw.c ---- a/dwm/drw.c 2025-05-19 09:47:15.538090711 +0200 -+++ b/dwm/drw.c 2025-05-23 09:43:25.178507493 +0200 -@@ -181,7 +181,7 @@ - /* Wrapper to create color schemes. The caller has to call free(3) on the - * returned color scheme when done using it. */ - Clr * --drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) -+drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount) - { - size_t i; - Clr *ret; -diff -r -u a/dwm/drw.h b/dwm/drw.h ---- a/dwm/drw.h 2025-05-19 09:47:15.538090711 +0200 -+++ b/dwm/drw.h 2025-05-23 09:43:25.178507493 +0200 -@@ -40,7 +40,7 @@ - - /* Colorscheme abstraction */ - void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); --Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); -+Clr *drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount); - - /* Cursor abstraction */ - Cur *drw_cur_create(Drw *drw, int shape); -diff -r -u a/dwm/dwm.c b/dwm/dwm.c ---- a/dwm/dwm.c 2025-05-19 09:47:15.538090711 +0200 -+++ b/dwm/dwm.c 2025-05-23 09:43:25.178507493 +0200 -@@ -35,11 +35,18 @@ - #include - #include - #include -+#include - #include - #ifdef XINERAMA - #include - #endif /* XINERAMA */ - #include -+#include -+#include -+#ifdef __OpenBSD__ -+#include -+#include -+#endif /* __OpenBSD */ - - #include "drw.h" - #include "util.h" -@@ -49,12 +56,28 @@ - #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) - #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ - * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) --#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) -+#define ISVISIBLEONTAG(C, T) ((C->tags & T)) -+#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags]) - #define MOUSEMASK (BUTTONMASK|PointerMotionMask) - #define WIDTH(X) ((X)->w + 2 * (X)->bw) - #define HEIGHT(X) ((X)->h + 2 * (X)->bw) - #define TAGMASK ((1 << LENGTH(tags)) - 1) - #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] == '#') { \ -+ int i = 1; \ -+ for (; i <= 6; i++) { \ -+ if (value.addr[i] < 48) break; \ -+ if (value.addr[i] > 57 && value.addr[i] < 65) break; \ -+ if (value.addr[i] > 70 && value.addr[i] < 97) break; \ -+ if (value.addr[i] > 102) break; \ -+ } \ -+ if (i == 7) { \ -+ strncpy(V, value.addr, 7); \ -+ V[7] = '\0'; \ -+ } \ -+ } \ -+ } - - /* enums */ - enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ -@@ -91,9 +114,11 @@ - int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; - int bw, oldbw; - unsigned int tags; -- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; -+ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow; -+ pid_t pid; - Client *next; - Client *snext; -+ Client *swallowing; - Monitor *mon; - Window win; - }; -@@ -137,6 +162,8 @@ - const char *title; - unsigned int tags; - int isfloating; -+ int isterminal; -+ int noswallow; - int monitor; - } Rule; - -@@ -146,6 +173,7 @@ - static void arrange(Monitor *m); - static void arrangemon(Monitor *m); - static void attach(Client *c); -+static void attachaside(Client *c); - static void attachstack(Client *c); - static void buttonpress(XEvent *e); - static void checkotherwm(void); -@@ -156,12 +184,15 @@ - static void configurenotify(XEvent *e); - static void configurerequest(XEvent *e); - static Monitor *createmon(void); -+static void deck(Monitor *m); - static void destroynotify(XEvent *e); - static void detach(Client *c); - static void detachstack(Client *c); - static Monitor *dirtomon(int dir); - static void drawbar(Monitor *m); - static void drawbars(void); -+static void enqueue(Client *c); -+static void enqueuestack(Client *c); - static void enternotify(XEvent *e); - static void expose(XEvent *e); - static void focus(Client *c); -@@ -177,12 +208,14 @@ - static void incna(const Arg *arg); - static void keypress(XEvent *e); - static void killclient(const Arg *arg); -+static void loadxrdb(void); - static void manage(Window w, XWindowAttributes *wa); - static void mappingnotify(XEvent *e); - static void maprequest(XEvent *e); - static void monocle(Monitor *m); - static void motionnotify(XEvent *e); - static void movemouse(const Arg *arg); -+static Client *nexttagged(Client *c); - static Client *nexttiled(Client *c); - static void pop(Client *c); - static void propertynotify(XEvent *e); -@@ -192,6 +225,7 @@ - static void resizeclient(Client *c, int x, int y, int w, int h); - static void resizemouse(const Arg *arg); - static void restack(Monitor *m); -+static void rotatestack(const Arg *arg); - static void run(void); - static void scan(void); - static int sendevent(Client *c, Atom proto); -@@ -226,12 +260,25 @@ - static void updatewindowtype(Client *c); - static void updatewmhints(Client *c); - static void view(const Arg *arg); -+static void viewnext(const Arg *arg); -+static void viewprev(const Arg *arg); - static Client *wintoclient(Window w); - static Monitor *wintomon(Window w); - static int xerror(Display *dpy, XErrorEvent *ee); - static int xerrordummy(Display *dpy, XErrorEvent *ee); - static int xerrorstart(Display *dpy, XErrorEvent *ee); -+static void xrdb(const Arg *arg); - static void zoom(const Arg *arg); -+static unsigned int nexttag(void); -+static unsigned int prevtag(void); -+static void tagtonext(const Arg *arg); -+static void tagtoprev(const Arg *arg); -+ -+static pid_t getparentprocess(pid_t p); -+static int isdescprocess(pid_t p, pid_t c); -+static Client *swallowingclient(Window w); -+static Client *termforwin(const Client *c); -+static pid_t winpid(Window w); - - /* variables */ - static const char broken[] = "broken"; -@@ -267,6 +314,8 @@ - static Monitor *mons, *selmon; - static Window root, wmcheckwin; - -+static xcb_connection_t *xcon; -+ - /* configuration, allows nested code to access above variables */ - #include "config.h" - -@@ -296,6 +345,8 @@ - && (!r->class || strstr(class, r->class)) - && (!r->instance || strstr(instance, r->instance))) - { -+ c->isterminal = r->isterminal; -+ c->noswallow = r->noswallow; - c->isfloating = r->isfloating; - c->tags |= r->tags; - for (m = mons; m && m->num != r->monitor; m = m->next); -@@ -408,6 +459,17 @@ - } - - void -+attachaside(Client *c) { -+ Client *at = nexttagged(c); -+ if(!at) { -+ attach(c); -+ return; -+ } -+ c->next = at->next; -+ at->next = c; -+} -+ -+void - attachstack(Client *c) - { - c->snext = c->mon->stack; -@@ -415,6 +477,53 @@ - } - - void -+swallow(Client *p, Client *c) -+{ -+ -+ if (c->noswallow || c->isterminal) -+ return; -+ if (c->noswallow && !swallowfloating && c->isfloating) -+ return; -+ -+ detach(c); -+ detachstack(c); -+ -+ setclientstate(c, WithdrawnState); -+ XUnmapWindow(dpy, p->win); -+ -+ p->swallowing = c; -+ c->mon = p->mon; -+ -+ Window w = p->win; -+ p->win = c->win; -+ c->win = w; -+ updatetitle(p); -+ XMoveResizeWindow(dpy, p->win, p->x, p->y, p->w, p->h); -+ arrange(p->mon); -+ configure(p); -+ updateclientlist(); -+} -+ -+void -+unswallow(Client *c) -+{ -+ c->win = c->swallowing->win; -+ -+ free(c->swallowing); -+ c->swallowing = NULL; -+ -+ /* unfullscreen the client */ -+ setfullscreen(c, 0); -+ updatetitle(c); -+ arrange(c->mon); -+ XMapWindow(dpy, c->win); -+ XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); -+ setclientstate(c, NormalState); -+ focus(NULL); -+ arrange(c->mon); -+} -+ -+void - buttonpress(XEvent *e) - { - unsigned int i, x, click; -@@ -654,6 +763,34 @@ - - if ((c = wintoclient(ev->window))) - unmanage(c, 1); -+ -+ else if ((c = swallowingclient(ev->window))) -+ unmanage(c->swallowing, 1); -+} -+ -+void -+deck(Monitor *m) { -+ unsigned int i, n, h, mw, my; -+ Client *c; -+ -+ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); -+ if(n == 0) -+ return; -+ -+ if(n > m->na) { -+ mw = m->na ? m->ww * m->mfact : 0; -+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->na); -+ } -+ else -+ mw = m->ww; -+ for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) -+ if(i < m->na) { -+ h = (m->wh - my) / (MIN(n, m->na) - i); -+ resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False); -+ my += HEIGHT(c); -+ } -+ else -+ resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False); - } - - void -@@ -757,6 +894,28 @@ - } - - void -+enqueue(Client *c) -+{ -+ Client *l; -+ for (l = c->mon->clients; l && l->next; l = l->next); -+ if (l) { -+ l->next = c; -+ c->next = NULL; -+ } -+} -+ -+void -+enqueuestack(Client *c) -+{ -+ Client *l; -+ for (l = c->mon->stack; l && l->snext; l = l->snext); -+ if (l) { -+ l->snext = c; -+ c->snext = NULL; -+ } -+} -+ -+void - enternotify(XEvent *e) - { - Client *c; -@@ -1028,14 +1187,46 @@ - } - - void -+loadxrdb() -+{ -+ Display *display; -+ char * resm; -+ XrmDatabase xrdb; -+ char *type; -+ XrmValue value; -+ -+ display = XOpenDisplay(NULL); -+ -+ if (display != NULL) { -+ resm = XResourceManagerString(display); -+ -+ if (resm != NULL) { -+ xrdb = XrmGetStringDatabase(resm); -+ -+ if (xrdb != NULL) { -+ XRDB_LOAD_COLOR("dwm.normbordercolor", normbordercolor); -+ XRDB_LOAD_COLOR("dwm.normbgcolor", normbgcolor); -+ XRDB_LOAD_COLOR("dwm.normfgcolor", normfgcolor); -+ XRDB_LOAD_COLOR("dwm.selbordercolor", selbordercolor); -+ XRDB_LOAD_COLOR("dwm.selbgcolor", selbgcolor); -+ XRDB_LOAD_COLOR("dwm.selfgcolor", selfgcolor); -+ } -+ } -+ } -+ -+ XCloseDisplay(display); -+} -+ -+void - manage(Window w, XWindowAttributes *wa) - { -- Client *c, *t = NULL; -+ Client *c, *t = NULL, *term = NULL; - Window trans = None; - XWindowChanges wc; - - c = ecalloc(1, sizeof(Client)); - c->win = w; -+ c->pid = winpid(w); - /* geometry */ - c->x = c->oldx = wa->x; - c->y = c->oldy = wa->y; -@@ -1050,6 +1241,7 @@ - } else { - c->mon = selmon; - applyrules(c); -+ term = termforwin(c); - } - - if (c->x + WIDTH(c) > c->mon->wx + c->mon->ww) -@@ -1073,7 +1265,7 @@ - c->isfloating = c->oldstate = trans != None || c->isfixed; - if (c->isfloating) - XRaiseWindow(dpy, c->win); -- attach(c); -+ attachaside(c); - attachstack(c); - XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, - (unsigned char *) &(c->win), 1); -@@ -1084,6 +1276,8 @@ - c->mon->sel = c; - arrange(c->mon); - XMapWindow(dpy, c->win); -+ if (term) -+ swallow(term, c); - focus(NULL); - } - -@@ -1201,6 +1395,23 @@ - } - } - -+unsigned int -+nexttag(void) -+{ -+ unsigned int seltag = selmon->tagset[selmon->seltags]; -+ return seltag == (1 << (LENGTH(tags) - 1)) ? 1 : seltag << 1; -+} -+ -+Client * -+nexttagged(Client *c) { -+ Client *walked = c->mon->clients; -+ for(; -+ walked && (walked->isfloating || !ISVISIBLEONTAG(walked, c->tags)); -+ walked = walked->next -+ ); -+ return walked; -+} -+ - Client * - nexttiled(Client *c) - { -@@ -1217,6 +1428,13 @@ - arrange(c->mon); - } - -+unsigned int -+prevtag(void) -+{ -+ unsigned int seltag = selmon->tagset[selmon->seltags]; -+ return seltag == 1 ? (1 << (LENGTH(tags) - 1)) : seltag >> 1; -+} -+ - void - propertynotify(XEvent *e) - { -@@ -1285,12 +1503,26 @@ - resizeclient(Client *c, int x, int y, int w, int h) - { - XWindowChanges wc; -+ unsigned int n; -+ Client *nbc; - - c->oldx = c->x; c->x = wc.x = x; - c->oldy = c->y; c->y = wc.y = y; - c->oldw = c->w; c->w = wc.width = w; - c->oldh = c->h; c->h = wc.height = h; - wc.border_width = c->bw; -+ -+ for (n = 0, nbc = nexttiled(c->mon->clients); nbc; nbc = nexttiled(nbc->next), n++); -+ -+ if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) { -+ } else { -+ if (c->mon->lt[c->mon->sellt]->arrange == monocle || n == 1) { -+ wc.border_width = 0; -+ c->w = wc.width += c->bw * 2; -+ c->h = wc.height += c->bw * 2; -+ } -+ } -+ - XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); - configure(c); - XSync(dpy, False); -@@ -1379,6 +1611,38 @@ - } - - void -+rotatestack(const Arg *arg) -+{ -+ Client *c = NULL, *f; -+ -+ if (!selmon->sel) -+ return; -+ f = selmon->sel; -+ if (arg->i > 0) { -+ for (c = nexttiled(selmon->clients); c && nexttiled(c->next); c = nexttiled(c->next)); -+ if (c){ -+ detach(c); -+ attach(c); -+ detachstack(c); -+ attachstack(c); -+ } -+ } else { -+ if ((c = nexttiled(selmon->clients))){ -+ detach(c); -+ enqueue(c); -+ detachstack(c); -+ enqueuestack(c); -+ } -+ } -+ if (c){ -+ arrange(selmon); -+ //unfocus(f, 1); -+ focus(f); -+ restack(selmon); -+ } -+} -+ -+void - run(void) - { - XEvent ev; -@@ -1426,7 +1690,7 @@ - detachstack(c); - c->mon = m; - c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ -- attach(c); -+ attachaside(c); - attachstack(c); - focus(NULL); - arrange(NULL); -@@ -1684,6 +1948,32 @@ - } - - void -+tagtonext(const Arg *arg) -+{ -+ unsigned int tmp; -+ -+ if (selmon->sel == NULL) -+ return; -+ -+ tmp = nexttag(); -+ tag(&(const Arg){.ui = tmp }); -+ view(&(const Arg){.ui = tmp }); -+} -+ -+void -+tagtoprev(const Arg *arg) -+{ -+ unsigned int tmp; -+ -+ if (selmon->sel == NULL) -+ return; -+ -+ tmp = prevtag(); -+ tag(&(const Arg){.ui = tmp }); -+ view(&(const Arg){.ui = tmp }); -+} -+ -+void - tile(Monitor *m) - { - unsigned int i, n, h, mw, my, ty; -@@ -1780,6 +2070,20 @@ - Monitor *m = c->mon; - XWindowChanges wc; - -+ if (c->swallowing) { -+ unswallow(c); -+ return; -+ } -+ -+ Client *s = swallowingclient(c->win); -+ if (s) { -+ free(s->swallowing); -+ s->swallowing = NULL; -+ arrange(m); -+ focus(NULL); -+ return; -+ } -+ - detach(c); - detachstack(c); - if (!destroyed) { -@@ -1795,9 +2099,12 @@ - XUngrabServer(dpy); - } - free(c); -- focus(NULL); -- updateclientlist(); -- arrange(m); -+ -+ if (!s) { -+ arrange(m); -+ focus(NULL); -+ updateclientlist(); -+ } - } - - void -@@ -1914,7 +2221,7 @@ - m->clients = c->next; - detachstack(c); - c->mon = mons; -- attach(c); -+ attachaside(c); - attachstack(c); - } - if (m == selmon) -@@ -2061,6 +2368,148 @@ - arrange(selmon); - } - -+pid_t -+winpid(Window w) -+{ -+ -+ pid_t result = 0; -+ -+#ifdef __linux__ -+ xcb_res_client_id_spec_t spec = {0}; -+ spec.client = w; -+ spec.mask = XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID; -+ -+ xcb_generic_error_t *e = NULL; -+ xcb_res_query_client_ids_cookie_t c = xcb_res_query_client_ids(xcon, 1, &spec); -+ xcb_res_query_client_ids_reply_t *r = xcb_res_query_client_ids_reply(xcon, c, &e); -+ -+ if (!r) -+ return (pid_t)0; -+ -+ xcb_res_client_id_value_iterator_t i = xcb_res_query_client_ids_ids_iterator(r); -+ for (; i.rem; xcb_res_client_id_value_next(&i)) { -+ spec = i.data->spec; -+ if (spec.mask & XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID) { -+ uint32_t *t = xcb_res_client_id_value_value(i.data); -+ result = *t; -+ break; -+ } -+ } -+ -+ free(r); -+ -+ if (result == (pid_t)-1) -+ result = 0; -+ -+#endif /* __linux__ */ -+ -+#ifdef __OpenBSD__ -+ Atom type; -+ int format; -+ unsigned long len, bytes; -+ unsigned char *prop; -+ pid_t ret; -+ -+ if (XGetWindowProperty(dpy, w, XInternAtom(dpy, "_NET_WM_PID", 0), 0, 1, False, AnyPropertyType, &type, &format, &len, &bytes, &prop) != Success || !prop) -+ return 0; -+ -+ ret = *(pid_t*)prop; -+ XFree(prop); -+ result = ret; -+ -+#endif /* __OpenBSD__ */ -+ return result; -+} -+ -+pid_t -+getparentprocess(pid_t p) -+{ -+ unsigned int v = 0; -+ -+#ifdef __linux__ -+ FILE *f; -+ char buf[256]; -+ snprintf(buf, sizeof(buf) - 1, "/proc/%u/stat", (unsigned)p); -+ -+ if (!(f = fopen(buf, "r"))) -+ return 0; -+ -+ fscanf(f, "%*u %*s %*c %u", &v); -+ fclose(f); -+#endif /* __linux__*/ -+ -+#ifdef __OpenBSD__ -+ int n; -+ kvm_t *kd; -+ struct kinfo_proc *kp; -+ -+ kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, NULL); -+ if (!kd) -+ return 0; -+ -+ kp = kvm_getprocs(kd, KERN_PROC_PID, p, sizeof(*kp), &n); -+ v = kp->p_ppid; -+#endif /* __OpenBSD__ */ -+ -+ return (pid_t)v; -+} -+ -+int -+isdescprocess(pid_t p, pid_t c) -+{ -+ while (p != c && c != 0) -+ c = getparentprocess(c); -+ -+ return (int)c; -+} -+ -+Client * -+termforwin(const Client *w) -+{ -+ Client *c; -+ Monitor *m; -+ -+ if (!w->pid || w->isterminal) -+ return NULL; -+ -+ for (m = mons; m; m = m->next) { -+ for (c = m->clients; c; c = c->next) { -+ if (c->isterminal && !c->swallowing && c->pid && isdescprocess(c->pid, w->pid)) -+ return c; -+ } -+ } -+ -+ return NULL; -+} -+ -+Client * -+swallowingclient(Window w) -+{ -+ Client *c; -+ Monitor *m; -+ -+ for (m = mons; m; m = m->next) { -+ for (c = m->clients; c; c = c->next) { -+ if (c->swallowing && c->swallowing->win == w) -+ return c; -+ } -+ } -+ -+ return NULL; -+} -+ -+void -+viewnext(const Arg *arg) -+{ -+ view(&(const Arg){.ui = nexttag()}); -+} -+ -+void -+viewprev(const Arg *arg) -+{ -+ view(&(const Arg){.ui = prevtag()}); -+} -+ - Client * - wintoclient(Window w) - { -@@ -2128,6 +2577,17 @@ - } - - void -+xrdb(const Arg *arg) -+{ -+ loadxrdb(); -+ int i; -+ for (i = 0; i < LENGTH(colors); i++) -+ scheme[i] = drw_scm_create(drw, colors[i], 3); -+ focus(NULL); -+ arrange(NULL); -+} -+ -+void - zoom(const Arg *arg) - { - Client *c = selmon->sel; -@@ -2150,10 +2610,14 @@ - fputs("warning: no locale support\n", stderr); - if (!(dpy = XOpenDisplay(NULL))) - die("dwm: cannot open display"); -+ if (!(xcon = XGetXCBConnection(dpy))) -+ die("dwm: cannot get xcb connection\n"); - checkotherwm(); -+ XrmInitialize(); -+ loadxrdb(); - setup(); - #ifdef __OpenBSD__ -- if (pledge("stdio rpath proc exec", NULL) == -1) -+ if (pledge("stdio rpath proc exec ps", NULL) == -1) - die("pledge"); - #endif /* __OpenBSD__ */ - scan(); diff --git a/patch-dwm-280525 b/patch-dwm-280525 new file mode 100644 index 0000000..779d4cf --- /dev/null +++ b/patch-dwm-280525 @@ -0,0 +1,1049 @@ +diff -u /home/philip/.local/src/MASTER/dwm/config.def.h /home/philip/.local/src/WORKING/dwm/config.def.h +--- /home/philip/.local/src/MASTER/dwm/config.def.h 2025-05-24 15:06:33.290174186 +0200 ++++ /home/philip/.local/src/WORKING/dwm/config.def.h 2025-05-28 09:43:24.413444339 +0200 +@@ -1,34 +1,39 @@ + /* See LICENSE file for copyright and license details. */ ++#include + + /* appearance */ + static const unsigned int borderpx = 1; /* border pixel of windows */ + 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[] = { "monospace:size=10" }; +-static const char dmenufont[] = "monospace:size=10"; +-static const char col_gray1[] = "#222222"; +-static const char col_gray2[] = "#444444"; +-static const char col_gray3[] = "#bbbbbb"; +-static const char col_gray4[] = "#eeeeee"; +-static const char col_cyan[] = "#005577"; +-static const char *colors[][3] = { +- /* fg bg border */ +- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, +- [SchemeSel] = { col_gray4, col_cyan, col_cyan }, ++static const char *fonts[] = { "JetBrainsMono Nerd Font Mono:size=11" }; ++static const char dmenufont[] = "JetBrainsMono Nerd Font Mono:size=11"; ++static char normbgcolor[] = "#222222"; ++static char normbordercolor[] = "#444444"; ++static char normfgcolor[] = "#bbbbbb"; ++static char selfgcolor[] = "#eeeeee"; ++static char selbordercolor[] = "#005577"; ++static char selbgcolor[] = "#005577"; ++static char *colors[][3] = { ++ /* fg bg border */ ++ [SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor }, ++ [SchemeSel] = { selfgcolor, selbgcolor, selbordercolor }, + }; + + /* tagging */ +-static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; ++static const char *tags[] = { "Ⅰ" ,"Ⅱ", "Ⅲ", "Ⅳ"}; //, "5", "6", "7", "8", "9" }; + + static const Rule rules[] = { + /* xprop(1): + * WM_CLASS(STRING) = instance, class + * WM_NAME(STRING) = title + */ +- /* class instance title tags mask isfloating monitor */ +- { "Gimp", NULL, NULL, 0, 1, -1 }, +- { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, ++ /* class instance title tags mask isfloating isterminal noswallow monitor */ ++ { "Gimp", NULL, NULL, 0, 1, 0, 0, -1 }, ++ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1, -1 }, ++ { "Ghostty", NULL, NULL, 0, 0, 1, 0, -1 }, ++ { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */ + }; + + /* layout(s) */ +@@ -39,13 +44,14 @@ + + static const Layout layouts[] = { + /* symbol arrange function */ +- { "[]=", tile }, /* first entry is default */ +- { "><>", NULL }, /* no layout function means floating behavior */ +- { "[M]", monocle }, ++ { "[Ƭ]", tile }, /* first entry is default */ ++ { "[Φ]", NULL }, /* no layout function means floating behavior */ ++ { "[µ]", monocle }, /* everything is maximised */ ++ { "[D]", deck }, /* client windows superimposed */ + }; + + /* key definitions */ +-#define MODKEY Mod1Mask ++#define MODKEY Mod4Mask + #define TAGKEYS(KEY,TAG) \ + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ +@@ -57,44 +63,63 @@ + + /* commands */ + static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ +-static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; +-static const char *termcmd[] = { "st", NULL }; ++static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; ++static const char *termcmd[] = { "ghostty", NULL }; + + static const Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, +- { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, +- { MODKEY, XK_b, togglebar, {0} }, +- { MODKEY, XK_j, focusstack, {.i = +1 } }, +- { MODKEY, XK_k, focusstack, {.i = -1 } }, +- { MODKEY, XK_i, incnmaster, {.i = +1 } }, ++ { MODKEY, XK_Return, spawn, {.v = termcmd } }, ++ { MODKEY, XK_w, spawn, SHCMD("librewolf") }, ++ { MODKEY, XK_x, spawn, SHCMD("dmenu-power") }, ++ { MODKEY, XK_v, spawn, SHCMD("dmenu-connect") }, + { MODKEY, XK_d, incnmaster, {.i = -1 } }, +- { MODKEY, XK_h, setmfact, {.f = -0.05} }, +- { MODKEY, XK_l, setmfact, {.f = +0.05} }, +- { MODKEY, XK_Return, zoom, {0} }, +- { MODKEY, XK_Tab, view, {0} }, +- { MODKEY|ShiftMask, XK_c, killclient, {0} }, ++ { MODKEY, XK_i, incnmaster, {.i = +1 } }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, ++ { MODKEY, XK_r, setlayout, {.v = &layouts[3]} }, ++ { MODKEY, XK_h, setmfact, {.f = -0.05} }, ++ { MODKEY, XK_l, setmfact, {.f = +0.05} }, ++ { MODKEY, XK_comma, focusmon, {.i = -1 } }, ++ { MODKEY, XK_semicolon, focusmon, {.i = +1 } }, ++ { MODKEY, XK_F5, xrdb, {.v = NULL } }, ++ { MODKEY, XK_b, togglebar, {0} }, ++ { MODKEY, XK_Tab, view, {0} }, + { MODKEY, XK_space, setlayout, {0} }, ++ { MODKEY, XK_z, zoom, {0} }, ++ { MODKEY, XK_c, killclient, {0} }, ++ { MODKEY, XK_Right, viewnext, {0} }, ++ { MODKEY, XK_Left, viewprev, {0} }, ++ { MODKEY|ShiftMask, XK_Right, tagtonext, {0} }, ++ { MODKEY|ShiftMask, XK_Left, tagtoprev, {0} }, ++ { MODKEY|ControlMask, XK_Right, focusstack, {.i = +1 } }, ++ { MODKEY|ControlMask, XK_Left, focusstack, {.i = -1 } }, ++ { MODKEY|ShiftMask, XK_Up, rotatestack, {.i = +1 } }, ++ { MODKEY|ShiftMask, XK_Down, rotatestack, {.i = -1 } }, ++ { MODKEY|ShiftMask, XK_q, quit, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, +- { MODKEY, XK_0, view, {.ui = ~0 } }, +- { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, +- { MODKEY, XK_comma, focusmon, {.i = -1 } }, +- { MODKEY, XK_period, focusmon, {.i = +1 } }, ++ { MODKEY|ShiftMask, XK_agrave, tag, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, +- { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, +- TAGKEYS( XK_1, 0) +- TAGKEYS( XK_2, 1) +- TAGKEYS( XK_3, 2) +- TAGKEYS( XK_4, 3) +- TAGKEYS( XK_5, 4) +- TAGKEYS( XK_6, 5) +- TAGKEYS( XK_7, 6) +- TAGKEYS( XK_8, 7) +- TAGKEYS( XK_9, 8) +- { MODKEY|ShiftMask, XK_q, quit, {0} }, ++ { MODKEY|ShiftMask, XK_semicolon, tagmon, {.i = +1 } }, ++ { 0, XF86XK_AudioMute, spawn, SHCMD("dwm-audio voltoggle") }, ++ { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("dwm-audio volquieter") }, ++ { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("dwm-audio vollouder") }, ++ { 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("dmenu-power") }, ++ { 0, XK_Print, spawn, SHCMD("screenshot.sh") }, ++ TAGKEYS( XK_ampersand, 0) ++ TAGKEYS( XK_eacute, 1) ++ TAGKEYS( XK_quotedbl, 2) ++ TAGKEYS( XK_apostrophe, 3) ++ TAGKEYS( XK_parenleft, 4) ++ TAGKEYS( XK_minus, 5) ++ TAGKEYS( XK_egrave, 6) ++ TAGKEYS( XK_underscore, 7) ++ TAGKEYS( XK_ccedilla, 8) ++ TAGKEYS( XK_agrave, 9) + }; + + /* button definitions */ +Only in /home/philip/.local/src/WORKING/dwm: config.h +diff -u /home/philip/.local/src/MASTER/dwm/config.mk /home/philip/.local/src/WORKING/dwm/config.mk +--- /home/philip/.local/src/MASTER/dwm/config.mk 2025-05-24 15:06:33.290174186 +0200 ++++ /home/philip/.local/src/WORKING/dwm/config.mk 2025-05-28 09:43:24.413444339 +0200 +@@ -20,10 +20,11 @@ + # OpenBSD (uncomment) + #FREETYPEINC = ${X11INC}/freetype2 + #MANPREFIX = ${PREFIX}/man ++#KVMLIB = -lkvm + + # includes and libs + INCS = -I${X11INC} -I${FREETYPEINC} +-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} ++LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res ${KVMLIB} + + # flags + CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} +diff -u /home/philip/.local/src/MASTER/dwm/drw.c /home/philip/.local/src/WORKING/dwm/drw.c +--- /home/philip/.local/src/MASTER/dwm/drw.c 2025-05-24 15:06:33.290174186 +0200 ++++ /home/philip/.local/src/WORKING/dwm/drw.c 2025-05-28 09:43:24.416777675 +0200 +@@ -181,7 +181,7 @@ + /* Wrapper to create color schemes. The caller has to call free(3) on the + * returned color scheme when done using it. */ + Clr * +-drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) ++drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount) + { + size_t i; + Clr *ret; +diff -u /home/philip/.local/src/MASTER/dwm/drw.h /home/philip/.local/src/WORKING/dwm/drw.h +--- /home/philip/.local/src/MASTER/dwm/drw.h 2025-05-24 15:06:33.290174186 +0200 ++++ /home/philip/.local/src/WORKING/dwm/drw.h 2025-05-28 09:43:24.416777675 +0200 +@@ -40,7 +40,7 @@ + + /* Colorscheme abstraction */ + void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); +-Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); ++Clr *drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount); + + /* Cursor abstraction */ + Cur *drw_cur_create(Drw *drw, int shape); +diff -u /home/philip/.local/src/MASTER/dwm/dwm.c /home/philip/.local/src/WORKING/dwm/dwm.c +--- /home/philip/.local/src/MASTER/dwm/dwm.c 2025-05-24 15:06:33.290174186 +0200 ++++ /home/philip/.local/src/WORKING/dwm/dwm.c 2025-05-28 09:43:24.416777675 +0200 +@@ -35,11 +35,18 @@ + #include + #include + #include ++#include + #include + #ifdef XINERAMA + #include + #endif /* XINERAMA */ + #include ++#include ++#include ++#ifdef __OpenBSD__ ++#include ++#include ++#endif /* __OpenBSD */ + + #include "drw.h" + #include "util.h" +@@ -49,19 +56,35 @@ + #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) + #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ + * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) +-#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) ++#define ISVISIBLEONTAG(C, T) ((C->tags & T)) ++#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags]) + #define MOUSEMASK (BUTTONMASK|PointerMotionMask) + #define WIDTH(X) ((X)->w + 2 * (X)->bw) + #define HEIGHT(X) ((X)->h + 2 * (X)->bw) + #define TAGMASK ((1 << LENGTH(tags)) - 1) + #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] == '#') { \ ++ int i = 1; \ ++ for (; i <= 6; i++) { \ ++ if (value.addr[i] < 48) break; \ ++ if (value.addr[i] > 57 && value.addr[i] < 65) break; \ ++ if (value.addr[i] > 70 && value.addr[i] < 97) break; \ ++ if (value.addr[i] > 102) break; \ ++ } \ ++ if (i == 7) { \ ++ strncpy(V, value.addr, 7); \ ++ V[7] = '\0'; \ ++ } \ ++ } \ ++ } + + /* enums */ + 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 */ +@@ -91,9 +114,11 @@ + int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; + int bw, oldbw; + unsigned int tags; +- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; ++ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow; ++ pid_t pid; + Client *next; + Client *snext; ++ Client *swallowing; + Monitor *mon; + Window win; + }; +@@ -137,6 +162,8 @@ + const char *title; + unsigned int tags; + int isfloating; ++ int isterminal; ++ int noswallow; + int monitor; + } Rule; + +@@ -146,6 +173,7 @@ + static void arrange(Monitor *m); + static void arrangemon(Monitor *m); + static void attach(Client *c); ++static void attachaside(Client *c); + static void attachstack(Client *c); + static void buttonpress(XEvent *e); + static void checkotherwm(void); +@@ -156,12 +184,15 @@ + static void configurenotify(XEvent *e); + static void configurerequest(XEvent *e); + static Monitor *createmon(void); ++static void deck(Monitor *m); + static void destroynotify(XEvent *e); + static void detach(Client *c); + static void detachstack(Client *c); + static Monitor *dirtomon(int dir); + static void drawbar(Monitor *m); + static void drawbars(void); ++static void enqueue(Client *c); ++static void enqueuestack(Client *c); + static void enternotify(XEvent *e); + static void expose(XEvent *e); + static void focus(Client *c); +@@ -177,12 +208,14 @@ + static void incnmaster(const Arg *arg); + static void keypress(XEvent *e); + static void killclient(const Arg *arg); ++static void loadxrdb(void); + static void manage(Window w, XWindowAttributes *wa); + static void mappingnotify(XEvent *e); + static void maprequest(XEvent *e); + static void monocle(Monitor *m); + static void motionnotify(XEvent *e); + static void movemouse(const Arg *arg); ++static Client *nexttagged(Client *c); + static Client *nexttiled(Client *c); + static void pop(Client *c); + static void propertynotify(XEvent *e); +@@ -192,11 +225,13 @@ + static void resizeclient(Client *c, int x, int y, int w, int h); + static void resizemouse(const Arg *arg); + static void restack(Monitor *m); ++static void rotatestack(const Arg *arg); + static void run(void); + 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); +@@ -226,12 +261,25 @@ + static void updatewindowtype(Client *c); + static void updatewmhints(Client *c); + static void view(const Arg *arg); ++static void viewnext(const Arg *arg); ++static void viewprev(const Arg *arg); + static Client *wintoclient(Window w); + static Monitor *wintomon(Window w); + static int xerror(Display *dpy, XErrorEvent *ee); + static int xerrordummy(Display *dpy, XErrorEvent *ee); + static int xerrorstart(Display *dpy, XErrorEvent *ee); ++static void xrdb(const Arg *arg); + static void zoom(const Arg *arg); ++static unsigned int nexttag(void); ++static unsigned int prevtag(void); ++static void tagtonext(const Arg *arg); ++static void tagtoprev(const Arg *arg); ++ ++static pid_t getparentprocess(pid_t p); ++static int isdescprocess(pid_t p, pid_t c); ++static Client *swallowingclient(Window w); ++static Client *termforwin(const Client *c); ++static pid_t winpid(Window w); + + /* variables */ + static const char broken[] = "broken"; +@@ -267,6 +315,8 @@ + static Monitor *mons, *selmon; + static Window root, wmcheckwin; + ++static xcb_connection_t *xcon; ++ + /* configuration, allows nested code to access above variables */ + #include "config.h" + +@@ -296,6 +346,8 @@ + && (!r->class || strstr(class, r->class)) + && (!r->instance || strstr(instance, r->instance))) + { ++ c->isterminal = r->isterminal; ++ c->noswallow = r->noswallow; + c->isfloating = r->isfloating; + c->tags |= r->tags; + for (m = mons; m && m->num != r->monitor; m = m->next); +@@ -408,6 +460,17 @@ + } + + void ++attachaside(Client *c) { ++ Client *at = nexttagged(c); ++ if(!at) { ++ attach(c); ++ return; ++ } ++ c->next = at->next; ++ at->next = c; ++} ++ ++void + attachstack(Client *c) + { + c->snext = c->mon->stack; +@@ -415,6 +478,53 @@ + } + + void ++swallow(Client *p, Client *c) ++{ ++ ++ if (c->noswallow || c->isterminal) ++ return; ++ if (c->noswallow && !swallowfloating && c->isfloating) ++ return; ++ ++ detach(c); ++ detachstack(c); ++ ++ setclientstate(c, WithdrawnState); ++ XUnmapWindow(dpy, p->win); ++ ++ p->swallowing = c; ++ c->mon = p->mon; ++ ++ Window w = p->win; ++ p->win = c->win; ++ c->win = w; ++ updatetitle(p); ++ XMoveResizeWindow(dpy, p->win, p->x, p->y, p->w, p->h); ++ arrange(p->mon); ++ configure(p); ++ updateclientlist(); ++} ++ ++void ++unswallow(Client *c) ++{ ++ c->win = c->swallowing->win; ++ ++ free(c->swallowing); ++ c->swallowing = NULL; ++ ++ /* unfullscreen the client */ ++ setfullscreen(c, 0); ++ updatetitle(c); ++ arrange(c->mon); ++ XMapWindow(dpy, c->win); ++ XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); ++ setclientstate(c, NormalState); ++ focus(NULL); ++ arrange(c->mon); ++} ++ ++void + buttonpress(XEvent *e) + { + unsigned int i, x, click; +@@ -654,6 +764,34 @@ + + if ((c = wintoclient(ev->window))) + unmanage(c, 1); ++ ++ else if ((c = swallowingclient(ev->window))) ++ unmanage(c->swallowing, 1); ++} ++ ++void ++deck(Monitor *m) { ++ unsigned int i, n, h, mw, my; ++ Client *c; ++ ++ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ if(n == 0) ++ return; ++ ++ if(n > m->nmaster) { ++ mw = m->nmaster ? m->ww * m->mfact : 0; ++ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster); ++ } ++ else ++ mw = m->ww; ++ for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) ++ if(i < m->nmaster) { ++ h = (m->wh - my) / (MIN(n, m->nmaster) - i); ++ resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False); ++ my += HEIGHT(c); ++ } ++ else ++ resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False); + } + + void +@@ -757,6 +895,28 @@ + } + + void ++enqueue(Client *c) ++{ ++ Client *l; ++ for (l = c->mon->clients; l && l->next; l = l->next); ++ if (l) { ++ l->next = c; ++ c->next = NULL; ++ } ++} ++ ++void ++enqueuestack(Client *c) ++{ ++ Client *l; ++ for (l = c->mon->stack; l && l->snext; l = l->snext); ++ if (l) { ++ l->snext = c; ++ c->snext = NULL; ++ } ++} ++ ++void + enternotify(XEvent *e) + { + Client *c; +@@ -1028,14 +1188,46 @@ + } + + void ++loadxrdb() ++{ ++ Display *display; ++ char * resm; ++ XrmDatabase xrdb; ++ char *type; ++ XrmValue value; ++ ++ display = XOpenDisplay(NULL); ++ ++ if (display != NULL) { ++ resm = XResourceManagerString(display); ++ ++ if (resm != NULL) { ++ xrdb = XrmGetStringDatabase(resm); ++ ++ if (xrdb != NULL) { ++ XRDB_LOAD_COLOR("dwm.normbordercolor", normbordercolor); ++ XRDB_LOAD_COLOR("dwm.normbgcolor", normbgcolor); ++ XRDB_LOAD_COLOR("dwm.normfgcolor", normfgcolor); ++ XRDB_LOAD_COLOR("dwm.selbordercolor", selbordercolor); ++ XRDB_LOAD_COLOR("dwm.selbgcolor", selbgcolor); ++ XRDB_LOAD_COLOR("dwm.selfgcolor", selfgcolor); ++ } ++ } ++ } ++ ++ XCloseDisplay(display); ++} ++ ++void + manage(Window w, XWindowAttributes *wa) + { +- Client *c, *t = NULL; ++ Client *c, *t = NULL, *term = NULL; + Window trans = None; + XWindowChanges wc; + + c = ecalloc(1, sizeof(Client)); + c->win = w; ++ c->pid = winpid(w); + /* geometry */ + c->x = c->oldx = wa->x; + c->y = c->oldy = wa->y; +@@ -1050,6 +1242,7 @@ + } else { + c->mon = selmon; + applyrules(c); ++ term = termforwin(c); + } + + if (c->x + WIDTH(c) > c->mon->wx + c->mon->ww) +@@ -1067,13 +1260,33 @@ + 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) + c->isfloating = c->oldstate = trans != None || c->isfixed; + if (c->isfloating) + XRaiseWindow(dpy, c->win); +- attach(c); ++ attachaside(c); + attachstack(c); + XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, + (unsigned char *) &(c->win), 1); +@@ -1084,6 +1297,8 @@ + c->mon->sel = c; + arrange(c->mon); + XMapWindow(dpy, c->win); ++ if (term) ++ swallow(term, c); + focus(NULL); + } + +@@ -1201,6 +1416,23 @@ + } + } + ++unsigned int ++nexttag(void) ++{ ++ unsigned int seltag = selmon->tagset[selmon->seltags]; ++ return seltag == (1 << (LENGTH(tags) - 1)) ? 1 : seltag << 1; ++} ++ ++Client * ++nexttagged(Client *c) { ++ Client *walked = c->mon->clients; ++ for(; ++ walked && (walked->isfloating || !ISVISIBLEONTAG(walked, c->tags)); ++ walked = walked->next ++ ); ++ return walked; ++} ++ + Client * + nexttiled(Client *c) + { +@@ -1217,6 +1449,13 @@ + arrange(c->mon); + } + ++unsigned int ++prevtag(void) ++{ ++ unsigned int seltag = selmon->tagset[selmon->seltags]; ++ return seltag == 1 ? (1 << (LENGTH(tags) - 1)) : seltag >> 1; ++} ++ + void + propertynotify(XEvent *e) + { +@@ -1285,12 +1524,26 @@ + resizeclient(Client *c, int x, int y, int w, int h) + { + XWindowChanges wc; ++ unsigned int n; ++ Client *nbc; + + c->oldx = c->x; c->x = wc.x = x; + c->oldy = c->y; c->y = wc.y = y; + c->oldw = c->w; c->w = wc.width = w; + c->oldh = c->h; c->h = wc.height = h; + wc.border_width = c->bw; ++ ++ for (n = 0, nbc = nexttiled(c->mon->clients); nbc; nbc = nexttiled(nbc->next), n++); ++ ++ if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) { ++ } else { ++ if (c->mon->lt[c->mon->sellt]->arrange == monocle || n == 1) { ++ wc.border_width = 0; ++ c->w = wc.width += c->bw * 2; ++ c->h = wc.height += c->bw * 2; ++ } ++ } ++ + XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); + configure(c); + XSync(dpy, False); +@@ -1379,6 +1632,38 @@ + } + + void ++rotatestack(const Arg *arg) ++{ ++ Client *c = NULL, *f; ++ ++ if (!selmon->sel) ++ return; ++ f = selmon->sel; ++ if (arg->i > 0) { ++ for (c = nexttiled(selmon->clients); c && nexttiled(c->next); c = nexttiled(c->next)); ++ if (c){ ++ detach(c); ++ attach(c); ++ detachstack(c); ++ attachstack(c); ++ } ++ } else { ++ if ((c = nexttiled(selmon->clients))){ ++ detach(c); ++ enqueue(c); ++ detachstack(c); ++ enqueuestack(c); ++ } ++ } ++ if (c){ ++ arrange(selmon); ++ //unfocus(f, 1); ++ focus(f); ++ restack(selmon); ++ } ++} ++ ++void + run(void) + { + XEvent ev; +@@ -1426,8 +1711,9 @@ + detachstack(c); + c->mon = m; + c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ +- attach(c); ++ attachaside(c); + attachstack(c); ++ setclienttagprop(c); + focus(NULL); + arrange(NULL); + } +@@ -1578,6 +1864,7 @@ + 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); +@@ -1601,6 +1888,7 @@ + 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 +@@ -1666,10 +1954,21 @@ + } + + 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); + } +@@ -1684,6 +1983,32 @@ + } + + void ++tagtonext(const Arg *arg) ++{ ++ unsigned int tmp; ++ ++ if (selmon->sel == NULL) ++ return; ++ ++ tmp = nexttag(); ++ tag(&(const Arg){.ui = tmp }); ++ view(&(const Arg){.ui = tmp }); ++} ++ ++void ++tagtoprev(const Arg *arg) ++{ ++ unsigned int tmp; ++ ++ if (selmon->sel == NULL) ++ return; ++ ++ tmp = prevtag(); ++ tag(&(const Arg){.ui = tmp }); ++ view(&(const Arg){.ui = tmp }); ++} ++ ++void + tile(Monitor *m) + { + unsigned int i, n, h, mw, my, ty; +@@ -1744,6 +2069,7 @@ + newtags = selmon->sel->tags ^ (arg->ui & TAGMASK); + if (newtags) { + selmon->sel->tags = newtags; ++ setclienttagprop(selmon->sel); + focus(NULL); + arrange(selmon); + } +@@ -1780,6 +2106,20 @@ + Monitor *m = c->mon; + XWindowChanges wc; + ++ if (c->swallowing) { ++ unswallow(c); ++ return; ++ } ++ ++ Client *s = swallowingclient(c->win); ++ if (s) { ++ free(s->swallowing); ++ s->swallowing = NULL; ++ arrange(m); ++ focus(NULL); ++ return; ++ } ++ + detach(c); + detachstack(c); + if (!destroyed) { +@@ -1795,9 +2135,12 @@ + XUngrabServer(dpy); + } + free(c); +- focus(NULL); +- updateclientlist(); +- arrange(m); ++ ++ if (!s) { ++ arrange(m); ++ focus(NULL); ++ updateclientlist(); ++ } + } + + void +@@ -1914,7 +2257,7 @@ + m->clients = c->next; + detachstack(c); + c->mon = mons; +- attach(c); ++ attachaside(c); + attachstack(c); + } + if (m == selmon) +@@ -2061,6 +2404,148 @@ + arrange(selmon); + } + ++pid_t ++winpid(Window w) ++{ ++ ++ pid_t result = 0; ++ ++#ifdef __linux__ ++ xcb_res_client_id_spec_t spec = {0}; ++ spec.client = w; ++ spec.mask = XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID; ++ ++ xcb_generic_error_t *e = NULL; ++ xcb_res_query_client_ids_cookie_t c = xcb_res_query_client_ids(xcon, 1, &spec); ++ xcb_res_query_client_ids_reply_t *r = xcb_res_query_client_ids_reply(xcon, c, &e); ++ ++ if (!r) ++ return (pid_t)0; ++ ++ xcb_res_client_id_value_iterator_t i = xcb_res_query_client_ids_ids_iterator(r); ++ for (; i.rem; xcb_res_client_id_value_next(&i)) { ++ spec = i.data->spec; ++ if (spec.mask & XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID) { ++ uint32_t *t = xcb_res_client_id_value_value(i.data); ++ result = *t; ++ break; ++ } ++ } ++ ++ free(r); ++ ++ if (result == (pid_t)-1) ++ result = 0; ++ ++#endif /* __linux__ */ ++ ++#ifdef __OpenBSD__ ++ Atom type; ++ int format; ++ unsigned long len, bytes; ++ unsigned char *prop; ++ pid_t ret; ++ ++ if (XGetWindowProperty(dpy, w, XInternAtom(dpy, "_NET_WM_PID", 0), 0, 1, False, AnyPropertyType, &type, &format, &len, &bytes, &prop) != Success || !prop) ++ return 0; ++ ++ ret = *(pid_t*)prop; ++ XFree(prop); ++ result = ret; ++ ++#endif /* __OpenBSD__ */ ++ return result; ++} ++ ++pid_t ++getparentprocess(pid_t p) ++{ ++ unsigned int v = 0; ++ ++#ifdef __linux__ ++ FILE *f; ++ char buf[256]; ++ snprintf(buf, sizeof(buf) - 1, "/proc/%u/stat", (unsigned)p); ++ ++ if (!(f = fopen(buf, "r"))) ++ return 0; ++ ++ fscanf(f, "%*u %*s %*c %u", &v); ++ fclose(f); ++#endif /* __linux__*/ ++ ++#ifdef __OpenBSD__ ++ int n; ++ kvm_t *kd; ++ struct kinfo_proc *kp; ++ ++ kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, NULL); ++ if (!kd) ++ return 0; ++ ++ kp = kvm_getprocs(kd, KERN_PROC_PID, p, sizeof(*kp), &n); ++ v = kp->p_ppid; ++#endif /* __OpenBSD__ */ ++ ++ return (pid_t)v; ++} ++ ++int ++isdescprocess(pid_t p, pid_t c) ++{ ++ while (p != c && c != 0) ++ c = getparentprocess(c); ++ ++ return (int)c; ++} ++ ++Client * ++termforwin(const Client *w) ++{ ++ Client *c; ++ Monitor *m; ++ ++ if (!w->pid || w->isterminal) ++ return NULL; ++ ++ for (m = mons; m; m = m->next) { ++ for (c = m->clients; c; c = c->next) { ++ if (c->isterminal && !c->swallowing && c->pid && isdescprocess(c->pid, w->pid)) ++ return c; ++ } ++ } ++ ++ return NULL; ++} ++ ++Client * ++swallowingclient(Window w) ++{ ++ Client *c; ++ Monitor *m; ++ ++ for (m = mons; m; m = m->next) { ++ for (c = m->clients; c; c = c->next) { ++ if (c->swallowing && c->swallowing->win == w) ++ return c; ++ } ++ } ++ ++ return NULL; ++} ++ ++void ++viewnext(const Arg *arg) ++{ ++ view(&(const Arg){.ui = nexttag()}); ++} ++ ++void ++viewprev(const Arg *arg) ++{ ++ view(&(const Arg){.ui = prevtag()}); ++} ++ + Client * + wintoclient(Window w) + { +@@ -2128,6 +2613,17 @@ + } + + void ++xrdb(const Arg *arg) ++{ ++ loadxrdb(); ++ int i; ++ for (i = 0; i < LENGTH(colors); i++) ++ scheme[i] = drw_scm_create(drw, colors[i], 3); ++ focus(NULL); ++ arrange(NULL); ++} ++ ++void + zoom(const Arg *arg) + { + Client *c = selmon->sel; +@@ -2150,10 +2646,14 @@ + fputs("warning: no locale support\n", stderr); + if (!(dpy = XOpenDisplay(NULL))) + die("dwm: cannot open display"); ++ if (!(xcon = XGetXCBConnection(dpy))) ++ die("dwm: cannot get xcb connection\n"); + checkotherwm(); ++ XrmInitialize(); ++ loadxrdb(); + setup(); + #ifdef __OpenBSD__ +- if (pledge("stdio rpath proc exec", NULL) == -1) ++ if (pledge("stdio rpath proc exec ps", NULL) == -1) + die("pledge"); + #endif /* __OpenBSD__ */ + scan(); +Only in /home/philip/.local/src/MASTER/dwm/: .git +Only in /home/philip/.local/src/WORKING/dwm: README.md -- cgit v1.2.3