diff options
author | mhsn <mail@mhsn.net> | 2025-07-23 22:27:53 +0100 |
---|---|---|
committer | mhsn <mail@mhsn.net> | 2025-07-23 22:27:53 +0100 |
commit | 7f454eb4bd5b1b6ce7ab75942d0ec304ae70adae (patch) | |
tree | 22b1dc976996838306422eaf2892814707a25d5b | |
parent | e24dfcbb8a69462ecd6cc5e7074d3afd458808a5 (diff) | |
download | adelie-7f454eb4bd5b1b6ce7ab75942d0ec304ae70adae.tar.gz adelie-7f454eb4bd5b1b6ce7ab75942d0ec304ae70adae.zip |
dwm: add crazy amount of patches
-rw-r--r-- | x11-wm/dwm/dwm-9999.ebuild | 15 | ||||
-rw-r--r-- | x11-wm/dwm/files/01_centeredmaster.diff | 142 | ||||
-rw-r--r-- | x11-wm/dwm/files/01_layouts.diff | 382 | ||||
-rw-r--r-- | x11-wm/dwm/files/02_doublequit.diff | 52 | ||||
-rw-r--r-- | x11-wm/dwm/files/03_focusmaster.diff | 92 | ||||
-rw-r--r-- | x11-wm/dwm/files/04_push.diff | 83 | ||||
-rw-r--r-- | x11-wm/dwm/files/05_scratchpad.diff | 92 | ||||
-rw-r--r-- | x11-wm/dwm/files/06_swallow.diff | 398 | ||||
-rw-r--r-- | x11-wm/dwm/files/07_bulkkill.diff | 70 | ||||
-rw-r--r-- | x11-wm/dwm/files/50_larger-font.diff | 12 | ||||
-rw-r--r-- | x11-wm/dwm/files/51_colors.diff | 12 | ||||
-rw-r--r-- | x11-wm/dwm/files/52_keys.diff | 34 |
12 files changed, 1209 insertions, 175 deletions
diff --git a/x11-wm/dwm/dwm-9999.ebuild b/x11-wm/dwm/dwm-9999.ebuild index 87aa001..0e4b8bd 100644 --- a/x11-wm/dwm/dwm-9999.ebuild +++ b/x11-wm/dwm/dwm-9999.ebuild @@ -11,10 +11,16 @@ HOMEPAGE="https://dwm.suckless.org/" EGIT_REPO_URI="https://git.suckless.org/dwm" PATCHES=( - "${FILESDIR}/01_centeredmaster.diff" - "${FILESDIR}/50_larger-font.diff" - "${FILESDIR}/51_colors.diff" - "${FILESDIR}/52_keys.diff" + ${FILESDIR}/01_layouts.diff + ${FILESDIR}/02_doublequit.diff + ${FILESDIR}/03_focusmaster.diff + ${FILESDIR}/04_push.diff + ${FILESDIR}/05_scratchpad.diff + ${FILESDIR}/06_swallow.diff + ${FILESDIR}/07_bulkkill.diff + ${FILESDIR}/50_larger-font.diff + ${FILESDIR}/51_colors.diff + ${FILESDIR}/52_keys.diff ) LICENSE="MIT" @@ -23,6 +29,7 @@ IUSE="xinerama" RDEPEND=" media-libs/fontconfig + x11-libs/libxcb x11-libs/libX11 >=x11-libs/libXft-2.3.5 xinerama? ( x11-libs/libXinerama ) diff --git a/x11-wm/dwm/files/01_centeredmaster.diff b/x11-wm/dwm/files/01_centeredmaster.diff deleted file mode 100644 index f35b650..0000000 --- a/x11-wm/dwm/files/01_centeredmaster.diff +++ /dev/null @@ -1,142 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 7054c06..527b214 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -39,6 +39,8 @@ static const Layout layouts[] = { - { "[]=", tile }, /* first entry is default */ - { "><>", NULL }, /* no layout function means floating behavior */ - { "[M]", monocle }, -+ { "|M|", centeredmaster }, -+ { ">M>", centeredfloatingmaster }, - }; - - /* key definitions */ -@@ -74,6 +76,8 @@ static Key keys[] = { - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, -+ { MODKEY, XK_u, setlayout, {.v = &layouts[3]} }, -+ { MODKEY|ShiftMask, XK_u, setlayout, {.v = &layouts[4]} }, - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, -diff --git a/dwm.c b/dwm.c -index 0362114..1e81412 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -233,6 +233,8 @@ static int xerror(Display *dpy, XErrorEvent *ee); - static int xerrordummy(Display *dpy, XErrorEvent *ee); - static int xerrorstart(Display *dpy, XErrorEvent *ee); - static void zoom(const Arg *arg); -+static void centeredmaster(Monitor *m); -+static void centeredfloatingmaster(Monitor *m); - - /* variables */ - static const char broken[] = "broken"; -@@ -2139,3 +2141,106 @@ main(int argc, char *argv[]) - XCloseDisplay(dpy); - return EXIT_SUCCESS; - } -+ -+void -+centeredmaster(Monitor *m) -+{ -+ unsigned int i, n, h, mw, mx, my, oty, ety, tw; -+ Client *c; -+ -+ /* count number of clients in the selected monitor */ -+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); -+ if (n == 0) -+ return; -+ -+ /* initialize areas */ -+ mw = m->ww; -+ mx = 0; -+ my = 0; -+ tw = mw; -+ -+ if (n > m->nmaster) { -+ /* go mfact box in the center if more than nmaster clients */ -+ mw = m->nmaster ? m->ww * m->mfact : 0; -+ tw = m->ww - mw; -+ -+ if (n - m->nmaster > 1) { -+ /* only one client */ -+ mx = (m->ww - mw) / 2; -+ tw = (m->ww - mw) / 2; -+ } -+ } -+ -+ oty = 0; -+ ety = 0; -+ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) -+ if (i < m->nmaster) { -+ /* nmaster clients are stacked vertically, in the center -+ * of the screen */ -+ h = (m->wh - my) / (MIN(n, m->nmaster) - i); -+ resize(c, m->wx + mx, m->wy + my, mw - (2*c->bw), -+ h - (2*c->bw), 0); -+ my += HEIGHT(c); -+ } else { -+ /* stack clients are stacked vertically */ -+ if ((i - m->nmaster) % 2 ) { -+ h = (m->wh - ety) / ( (1 + n - i) / 2); -+ resize(c, m->wx, m->wy + ety, tw - (2*c->bw), -+ h - (2*c->bw), 0); -+ ety += HEIGHT(c); -+ } else { -+ h = (m->wh - oty) / ((1 + n - i) / 2); -+ resize(c, m->wx + mx + mw, m->wy + oty, -+ tw - (2*c->bw), h - (2*c->bw), 0); -+ oty += HEIGHT(c); -+ } -+ } -+} -+ -+void -+centeredfloatingmaster(Monitor *m) -+{ -+ unsigned int i, n, w, mh, mw, mx, mxo, my, myo, tx; -+ Client *c; -+ -+ /* count number of clients in the selected monitor */ -+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); -+ if (n == 0) -+ return; -+ -+ /* initialize nmaster area */ -+ if (n > m->nmaster) { -+ /* go mfact box in the center if more than nmaster clients */ -+ if (m->ww > m->wh) { -+ mw = m->nmaster ? m->ww * m->mfact : 0; -+ mh = m->nmaster ? m->wh * 0.9 : 0; -+ } else { -+ mh = m->nmaster ? m->wh * m->mfact : 0; -+ mw = m->nmaster ? m->ww * 0.9 : 0; -+ } -+ mx = mxo = (m->ww - mw) / 2; -+ my = myo = (m->wh - mh) / 2; -+ } else { -+ /* go fullscreen if all clients are in the master area */ -+ mh = m->wh; -+ mw = m->ww; -+ mx = mxo = 0; -+ my = myo = 0; -+ } -+ -+ for(i = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) -+ if (i < m->nmaster) { -+ /* nmaster clients are stacked horizontally, in the center -+ * of the screen */ -+ w = (mw + mxo - mx) / (MIN(n, m->nmaster) - i); -+ resize(c, m->wx + mx, m->wy + my, w - (2*c->bw), -+ mh - (2*c->bw), 0); -+ mx += WIDTH(c); -+ } else { -+ /* stack clients are stacked horizontally */ -+ w = (m->ww - tx) / (n - i); -+ resize(c, m->wx + tx, m->wy, w - (2*c->bw), -+ m->wh - (2*c->bw), 0); -+ tx += WIDTH(c); -+ } -+} diff --git a/x11-wm/dwm/files/01_layouts.diff b/x11-wm/dwm/files/01_layouts.diff new file mode 100644 index 0000000..bd0c2be --- /dev/null +++ b/x11-wm/dwm/files/01_layouts.diff @@ -0,0 +1,382 @@ +diff --git c/config.def.h w/config.def.h +index 9efa774..7ee7f9d 100644 +--- c/config.def.h ++++ w/config.def.h +@@ -39,9 +39,14 @@ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen win + + static const Layout layouts[] = { + /* symbol arrange function */ +- { "[]=", tile }, /* first entry is default */ ++ { "|+|", tatami }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ ++ { "[]=", tile }, + { "[M]", monocle }, ++ { "|M|", centeredmaster }, ++ { ">M>", centeredfloatingmaster }, ++ { "TTT", bstack }, ++ { "===", bstackhoriz }, + }; + + /* key definitions */ +@@ -74,9 +79,14 @@ static const Key keys[] = { + { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, +- { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, +- { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, +- { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, ++ { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, /* tatami */ ++ { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, /* floating */ ++ { MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[2]} }, /* tile */ ++ { MODKEY, XK_m, setlayout, {.v = &layouts[3]} }, /* monocle */ ++ { MODKEY, XK_u, setlayout, {.v = &layouts[4]} }, /* centeredmaster */ ++ { MODKEY|ShiftMask, XK_u, setlayout, {.v = &layouts[5]} }, /* centeredfloatingmaster */ ++ { MODKEY, XK_g, setlayout, {.v = &layouts[6]} }, /* bstack */ ++ { MODKEY|ShiftMask, XK_g, setlayout, {.v = &layouts[7]} }, /* bstackhoriz */ + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, +diff --git c/dwm.c w/dwm.c +index 1443802..b1c07e8 100644 +--- c/dwm.c ++++ w/dwm.c +@@ -232,6 +232,11 @@ static int xerror(Display *dpy, XErrorEvent *ee); + static int xerrordummy(Display *dpy, XErrorEvent *ee); + static int xerrorstart(Display *dpy, XErrorEvent *ee); + static void zoom(const Arg *arg); ++static void tatami(Monitor *m); ++static void bstack(Monitor *m); ++static void bstackhoriz(Monitor *m); ++static void centeredmaster(Monitor *m); ++static void centeredfloatingmaster(Monitor *m); + + /* variables */ + static const char broken[] = "broken"; +@@ -2162,3 +2167,327 @@ main(int argc, char *argv[]) + XCloseDisplay(dpy); + return EXIT_SUCCESS; + } ++ ++void ++tatami(Monitor *m) ++{ ++ unsigned int i, n, nx, ny, nw, nh, ++ mats, tc, ++ tnx, tny, tnw, tnh; ++ Client *c; ++ ++ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), ++n); ++ if(n == 0) ++ return; ++ ++ nx = m->wx; ++ ny = 0; ++ nw = m->ww; ++ nh = m->wh; ++ ++ c = nexttiled(m->clients); ++ ++ if(n != 1) nw = m->ww * m->mfact; ++ ny = m->wy; ++ ++ resize(c, nx, ny, nw - 2 * c->bw, nh - 2 * c->bw, False); ++ ++ c = nexttiled(c->next); ++ ++ nx += nw; ++ nw = m->ww - nw; ++ ++ if(n>1) ++ { ++ ++ tc = n-1; ++ mats = tc/5; ++ ++ nh/=(mats + (tc % 5 > 0)); ++ ++ for(i = 0; c && (i < (tc % 5)); c = nexttiled(c->next)) ++ { ++ tnw=nw; ++ tnx=nx; ++ tnh=nh; ++ tny=ny; ++ switch(tc - (mats*5)) ++ { ++ case 1://fill ++ break; ++ case 2://up and down ++ if((i % 5) == 0) //up ++ tnh/=2; ++ else if((i % 5) == 1) //down ++ { ++ tnh/=2; ++ tny += nh/2; ++ } ++ break; ++ case 3://bottom, up-left and up-right ++ if((i % 5) == 0) //up-left ++ { ++ tnw = nw/2; ++ tnh = (2*nh)/3; ++ } ++ else if((i % 5) == 1)//up-right ++ { ++ tnx += nw/2; ++ tnw = nw/2; ++ tnh = (2*nh)/3; ++ } ++ else if((i % 5) == 2)//bottom ++ { ++ tnh = nh/3; ++ tny += (2*nh)/3; ++ } ++ break; ++ case 4://bottom, left, right and top ++ if((i % 5) == 0) //top ++ { ++ tnh = (nh)/4; ++ } ++ else if((i % 5) == 1)//left ++ { ++ tnw = nw/2; ++ tny += nh/4; ++ tnh = (nh)/2; ++ } ++ else if((i % 5) == 2)//right ++ { ++ tnx += nw/2; ++ tnw = nw/2; ++ tny += nh/4; ++ tnh = (nh)/2; ++ } ++ else if((i % 5) == 3)//bottom ++ { ++ tny += (3*nh)/4; ++ tnh = (nh)/4; ++ } ++ break; ++ } ++ ++i; ++ resize(c, tnx, tny, tnw - 2 * c->bw, tnh - 2 * c->bw, False); ++ } ++ ++ ++mats; ++ ++ for(i = 0; c && (mats>0); c = nexttiled(c->next)) { ++ ++ if((i%5)==0) ++ { ++ --mats; ++ if(((tc % 5) > 0)||(i>=5)) ++ ny+=nh; ++ } ++ ++ tnw=nw; ++ tnx=nx; ++ tnh=nh; ++ tny=ny; ++ ++ ++ switch(i % 5) ++ { ++ case 0: //top-left-vert ++ tnw = (nw)/3; ++ tnh = (nh*2)/3; ++ break; ++ case 1: //top-right-hor ++ tnx += (nw)/3; ++ tnw = (nw*2)/3; ++ tnh = (nh)/3; ++ break; ++ case 2: //center ++ tnx += (nw)/3; ++ tnw = (nw)/3; ++ tny += (nh)/3; ++ tnh = (nh)/3; ++ break; ++ case 3: //bottom-right-vert ++ tnx += (nw*2)/3; ++ tnw = (nw)/3; ++ tny += (nh)/3; ++ tnh = (nh*2)/3; ++ break; ++ case 4: //(oldest) bottom-left-hor ++ tnw = (2*nw)/3; ++ tny += (2*nh)/3; ++ tnh = (nh)/3; ++ break; ++ default: ++ break; ++ } ++ ++ ++i; ++ //i%=5; ++ resize(c, tnx, tny, tnw - 2 * c->bw, tnh - 2 * c->bw, False); ++ } ++ } ++} ++ ++void ++bstack(Monitor *m) { ++ int w, h, mh, mx, tx, ty, tw; ++ unsigned int i, n; ++ Client *c; ++ ++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ if (n == 0) ++ return; ++ if (n > m->nmaster) { ++ mh = m->nmaster ? m->mfact * m->wh : 0; ++ tw = m->ww / (n - m->nmaster); ++ ty = m->wy + mh; ++ } else { ++ mh = m->wh; ++ tw = m->ww; ++ ty = m->wy; ++ } ++ for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { ++ if (i < m->nmaster) { ++ w = (m->ww - mx) / (MIN(n, m->nmaster) - i); ++ resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0); ++ mx += WIDTH(c); ++ } else { ++ h = m->wh - mh; ++ resize(c, tx, ty, tw - (2 * c->bw), h - (2 * c->bw), 0); ++ if (tw != m->ww) ++ tx += WIDTH(c); ++ } ++ } ++} ++ ++void ++bstackhoriz(Monitor *m) { ++ int w, mh, mx, tx, ty, th; ++ unsigned int i, n; ++ Client *c; ++ ++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ if (n == 0) ++ return; ++ if (n > m->nmaster) { ++ mh = m->nmaster ? m->mfact * m->wh : 0; ++ th = (m->wh - mh) / (n - m->nmaster); ++ ty = m->wy + mh; ++ } else { ++ th = mh = m->wh; ++ ty = m->wy; ++ } ++ for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { ++ if (i < m->nmaster) { ++ w = (m->ww - mx) / (MIN(n, m->nmaster) - i); ++ resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0); ++ mx += WIDTH(c); ++ } else { ++ resize(c, tx, ty, m->ww - (2 * c->bw), th - (2 * c->bw), 0); ++ if (th != m->wh) ++ ty += HEIGHT(c); ++ } ++ } ++} ++ ++void ++centeredmaster(Monitor *m) ++{ ++ unsigned int i, n, h, mw, mx, my, oty, ety, tw; ++ Client *c; ++ ++ /* count number of clients in the selected monitor */ ++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ if (n == 0) ++ return; ++ ++ /* initialize areas */ ++ mw = m->ww; ++ mx = 0; ++ my = 0; ++ tw = mw; ++ ++ if (n > m->nmaster) { ++ /* go mfact box in the center if more than nmaster clients */ ++ mw = m->nmaster ? m->ww * m->mfact : 0; ++ tw = m->ww - mw; ++ ++ if (n - m->nmaster > 1) { ++ /* only one client */ ++ mx = (m->ww - mw) / 2; ++ tw = (m->ww - mw) / 2; ++ } ++ } ++ ++ oty = 0; ++ ety = 0; ++ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) ++ if (i < m->nmaster) { ++ /* nmaster clients are stacked vertically, in the center ++ * of the screen */ ++ h = (m->wh - my) / (MIN(n, m->nmaster) - i); ++ resize(c, m->wx + mx, m->wy + my, mw - (2*c->bw), ++ h - (2*c->bw), 0); ++ my += HEIGHT(c); ++ } else { ++ /* stack clients are stacked vertically */ ++ if ((i - m->nmaster) % 2 ) { ++ h = (m->wh - ety) / ( (1 + n - i) / 2); ++ resize(c, m->wx, m->wy + ety, tw - (2*c->bw), ++ h - (2*c->bw), 0); ++ ety += HEIGHT(c); ++ } else { ++ h = (m->wh - oty) / ((1 + n - i) / 2); ++ resize(c, m->wx + mx + mw, m->wy + oty, ++ tw - (2*c->bw), h - (2*c->bw), 0); ++ oty += HEIGHT(c); ++ } ++ } ++} ++ ++void ++centeredfloatingmaster(Monitor *m) ++{ ++ unsigned int i, n, w, mh, mw, mx, mxo, my, myo, tx; ++ Client *c; ++ ++ /* count number of clients in the selected monitor */ ++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ if (n == 0) ++ return; ++ ++ /* initialize nmaster area */ ++ if (n > m->nmaster) { ++ /* go mfact box in the center if more than nmaster clients */ ++ if (m->ww > m->wh) { ++ mw = m->nmaster ? m->ww * m->mfact : 0; ++ mh = m->nmaster ? m->wh * 0.9 : 0; ++ } else { ++ mh = m->nmaster ? m->wh * m->mfact : 0; ++ mw = m->nmaster ? m->ww * 0.9 : 0; ++ } ++ mx = mxo = (m->ww - mw) / 2; ++ my = myo = (m->wh - mh) / 2; ++ } else { ++ /* go fullscreen if all clients are in the master area */ ++ mh = m->wh; ++ mw = m->ww; ++ mx = mxo = 0; ++ my = myo = 0; ++ } ++ ++ for(i = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) ++ if (i < m->nmaster) { ++ /* nmaster clients are stacked horizontally, in the center ++ * of the screen */ ++ w = (mw + mxo - mx) / (MIN(n, m->nmaster) - i); ++ resize(c, m->wx + mx, m->wy + my, w - (2*c->bw), ++ mh - (2*c->bw), 0); ++ mx += WIDTH(c); ++ } else { ++ /* stack clients are stacked horizontally */ ++ w = (m->ww - tx) / (n - i); ++ resize(c, m->wx + tx, m->wy, w - (2*c->bw), ++ m->wh - (2*c->bw), 0); ++ tx += WIDTH(c); ++ } ++} diff --git a/x11-wm/dwm/files/02_doublequit.diff b/x11-wm/dwm/files/02_doublequit.diff new file mode 100644 index 0000000..936e1fa --- /dev/null +++ b/x11-wm/dwm/files/02_doublequit.diff @@ -0,0 +1,52 @@ +diff --git c/config.def.h w/config.def.h +index 7ee7f9d..176294a 100644 +--- c/config.def.h ++++ w/config.def.h +@@ -21,6 +21,9 @@ static const char *colors[][3] = { + /* tagging */ + static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; + ++/* Lockfile */ ++static char lockfile[] = "/tmp/dwm.lock"; ++ + static const Rule rules[] = { + /* xprop(1): + * WM_CLASS(STRING) = instance, class +diff --git c/dwm.c w/dwm.c +index b1c07e8..55925bd 100644 +--- c/dwm.c ++++ w/dwm.c +@@ -27,6 +27,7 @@ + #include <stdio.h> + #include <stdlib.h> + #include <string.h> ++#include <time.h> + #include <unistd.h> + #include <sys/types.h> + #include <sys/wait.h> +@@ -1262,7 +1263,24 @@ propertynotify(XEvent *e) + void + quit(const Arg *arg) + { +- running = 0; ++ FILE *fd = NULL; ++ struct stat filestat; ++ ++ if ((fd = fopen(lockfile, "r")) && stat(lockfile, &filestat) == 0) { ++ fclose(fd); ++ ++ if (filestat.st_ctime <= time(NULL)-2) ++ remove(lockfile); ++ } ++ ++ if ((fd = fopen(lockfile, "r")) != NULL) { ++ fclose(fd); ++ remove(lockfile); ++ running = 0; ++ } else { ++ if ((fd = fopen(lockfile, "a")) != NULL) ++ fclose(fd); ++ } + } + + Monitor * diff --git a/x11-wm/dwm/files/03_focusmaster.diff b/x11-wm/dwm/files/03_focusmaster.diff new file mode 100644 index 0000000..4deb69e --- /dev/null +++ b/x11-wm/dwm/files/03_focusmaster.diff @@ -0,0 +1,92 @@ +diff --git c/config.def.h w/config.def.h +index 176294a..19600a6 100644 +--- c/config.def.h ++++ w/config.def.h +@@ -79,7 +79,8 @@ static const Key keys[] = { + { 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_Return, focusmaster, {0} }, ++ { MODKEY|ShiftMask, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, /* tatami */ +diff --git c/dwm.c w/dwm.c +index 55925bd..c68b29a 100644 +--- c/dwm.c ++++ w/dwm.c +@@ -127,6 +127,7 @@ struct Monitor { + Client *clients; + Client *sel; + Client *stack; ++ Client *tagmarked[32]; + Monitor *next; + Window barwin; + const Layout *lt[2]; +@@ -167,6 +168,7 @@ static void enternotify(XEvent *e); + static void expose(XEvent *e); + static void focus(Client *c); + static void focusin(XEvent *e); ++static void focusmaster(const Arg *arg); + static void focusmon(const Arg *arg); + static void focusstack(const Arg *arg); + static Atom getatomprop(Client *c, Atom prop); +@@ -667,6 +669,10 @@ detach(Client *c) + { + Client **tc; + ++ for (int i = 1; i < LENGTH(tags); i++) ++ if (c == c->mon->tagmarked[i]) ++ c->mon->tagmarked[i] = NULL; ++ + for (tc = &c->mon->clients; *tc && *tc != c; tc = &(*tc)->next); + *tc = c->next; + } +@@ -826,6 +832,34 @@ focusin(XEvent *e) + setfocus(selmon->sel); + } + ++void ++focusmaster(const Arg *arg) ++{ ++ Client *master; ++ ++ if (selmon->nmaster > 1) ++ return; ++ if (!selmon->sel || (selmon->sel->isfullscreen && lockfullscreen)) ++ return; ++ ++ master = nexttiled(selmon->clients); ++ ++ if (!master) ++ return; ++ ++ int i; ++ for (i = 0; !(selmon->tagset[selmon->seltags] & 1 << i); i++); ++ i++; ++ ++ if (selmon->sel == master) { ++ if (selmon->tagmarked[i] && ISVISIBLE(selmon->tagmarked[i])) ++ focus(selmon->tagmarked[i]); ++ } else { ++ selmon->tagmarked[i] = selmon->sel; ++ focus(master); ++ } ++} ++ + void + focusmon(const Arg *arg) + { +@@ -1217,6 +1251,11 @@ nexttiled(Client *c) + void + pop(Client *c) + { ++ int i; ++ for (i = 0; !(selmon->tagset[selmon->seltags] & 1 << i); i++); ++ i++; ++ ++ c->mon->tagmarked[i] = nexttiled(c->mon->clients); + detach(c); + attach(c); + focus(c); diff --git a/x11-wm/dwm/files/04_push.diff b/x11-wm/dwm/files/04_push.diff new file mode 100644 index 0000000..b79db76 --- /dev/null +++ b/x11-wm/dwm/files/04_push.diff @@ -0,0 +1,83 @@ +diff --git c/config.def.h w/config.def.h +index 19600a6..228e71d 100644 +--- c/config.def.h ++++ w/config.def.h +@@ -75,6 +75,8 @@ static const Key keys[] = { + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, ++ { MODKEY|ShiftMask, XK_j, pushdown, {0} }, ++ { MODKEY|ShiftMask, XK_k, pushup, {0} }, + { MODKEY, XK_i, incnmaster, {.i = +1 } }, + { MODKEY, XK_d, incnmaster, {.i = -1 } }, + { MODKEY, XK_h, setmfact, {.f = -0.05} }, +diff --git c/dwm.c w/dwm.c +index c68b29a..e5496bf 100644 +--- c/dwm.c ++++ w/dwm.c +@@ -188,7 +188,10 @@ static void motionnotify(XEvent *e); + static void movemouse(const Arg *arg); + static Client *nexttiled(Client *c); + static void pop(Client *c); ++static Client *prevtiled(Client *c); + static void propertynotify(XEvent *e); ++static void pushdown(const Arg *arg); ++static void pushup(const Arg *arg); + static void quit(const Arg *arg); + static Monitor *recttomon(int x, int y, int w, int h); + static void resize(Client *c, int x, int y, int w, int h, int interact); +@@ -1262,6 +1265,16 @@ pop(Client *c) + arrange(c->mon); + } + ++Client * ++prevtiled(Client *c) { ++ Client *p, *r; ++ ++ for(p = selmon->clients, r = NULL; p && p != c; p = p->next) ++ if(!p->isfloating && ISVISIBLE(p)) ++ r = p; ++ return r; ++} ++ + void + propertynotify(XEvent *e) + { +@@ -1299,6 +1312,37 @@ propertynotify(XEvent *e) + } + } + ++void ++pushdown(const Arg *arg) { ++ Client *sel = selmon->sel, *c; ++ ++ if(!sel || sel->isfloating || sel == nexttiled(selmon->clients)) ++ return; ++ if((c = nexttiled(sel->next))) { ++ detach(sel); ++ sel->next = c->next; ++ c->next = sel; ++ } ++ focus(sel); ++ arrange(selmon); ++} ++ ++void ++pushup(const Arg *arg) { ++ Client *sel = selmon->sel, *c; ++ ++ if(!sel || sel->isfloating) ++ return; ++ if((c = prevtiled(sel)) && c != nexttiled(selmon->clients)) { ++ detach(sel); ++ sel->next = c; ++ for(c = selmon->clients; c->next != sel->next; c = c->next); ++ c->next = sel; ++ } ++ focus(sel); ++ arrange(selmon); ++} ++ + void + quit(const Arg *arg) + { diff --git a/x11-wm/dwm/files/05_scratchpad.diff b/x11-wm/dwm/files/05_scratchpad.diff new file mode 100644 index 0000000..4e1ba10 --- /dev/null +++ b/x11-wm/dwm/files/05_scratchpad.diff @@ -0,0 +1,92 @@ +diff --git c/config.def.h w/config.def.h +index 228e71d..a85867f 100644 +--- c/config.def.h ++++ w/config.def.h +@@ -67,11 +67,14 @@ static const Layout layouts[] = { + 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 scratchpadname[] = "scratchpad"; ++static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL }; + + static const Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, ++ { MODKEY|ShiftMask, XK_s, togglescratch, {.v = scratchpadcmd } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, +diff --git c/dwm.c w/dwm.c +index e5496bf..3b19c82 100644 +--- c/dwm.c ++++ w/dwm.c +@@ -216,6 +216,7 @@ static void tagmon(const Arg *arg); + static void tile(Monitor *m); + static void togglebar(const Arg *arg); + static void togglefloating(const Arg *arg); ++static void togglescratch(const Arg *arg); + static void toggletag(const Arg *arg); + static void toggleview(const Arg *arg); + static void unfocus(Client *c, int setfocus); +@@ -281,6 +282,8 @@ static Window root, wmcheckwin; + /* configuration, allows nested code to access above variables */ + #include "config.h" + ++static unsigned int scratchtag = 1 << LENGTH(tags); ++ + /* compile-time check if all tags fit into an unsigned int bit array. */ + struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; + +@@ -1103,6 +1106,14 @@ manage(Window w, XWindowAttributes *wa) + c->y = MAX(c->y, c->mon->wy); + c->bw = borderpx; + ++ selmon->tagset[selmon->seltags] &= ~scratchtag; ++ if (!strcmp(c->name, scratchpadname)) { ++ c->mon->tagset[c->mon->seltags] |= c->tags = scratchtag; ++ c->isfloating = True; ++ c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2); ++ c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2); ++ } ++ + wc.border_width = c->bw; + XConfigureWindow(dpy, w, CWBorderWidth, &wc); + XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); +@@ -1756,6 +1767,7 @@ spawn(const Arg *arg) + + if (arg->v == dmenucmd) + dmenumon[0] = '0' + selmon->num; ++ selmon->tagset[selmon->seltags] &= ~scratchtag; + if (fork() == 0) { + if (dpy) + close(ConnectionNumber(dpy)); +@@ -1840,6 +1852,28 @@ togglefloating(const Arg *arg) + arrange(selmon); + } + ++void ++togglescratch(const Arg *arg) ++{ ++ Client *c; ++ unsigned int found = 0; ++ ++ for (c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next); ++ if (found) { ++ unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag; ++ if (newtagset) { ++ selmon->tagset[selmon->seltags] = newtagset; ++ focus(NULL); ++ arrange(selmon); ++ } ++ if (ISVISIBLE(c)) { ++ focus(c); ++ restack(selmon); ++ } ++ } else ++ spawn(arg); ++} ++ + void + toggletag(const Arg *arg) + { diff --git a/x11-wm/dwm/files/06_swallow.diff b/x11-wm/dwm/files/06_swallow.diff new file mode 100644 index 0000000..f4f3f00 --- /dev/null +++ b/x11-wm/dwm/files/06_swallow.diff @@ -0,0 +1,398 @@ +diff --git c/config.def.h w/config.def.h +index a85867f..a7a653c 100644 +--- c/config.def.h ++++ w/config.def.h +@@ -3,6 +3,7 @@ + /* 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" }; +@@ -29,9 +30,11 @@ static const Rule rules[] = { + * 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 }, ++ { "st", NULL, NULL, 0, 0, 1, 0, -1 }, ++ { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */ + }; + + /* layout(s) */ +diff --git c/config.mk w/config.mk +index 8efca9a..a933c0b 100644 +--- c/config.mk ++++ w/config.mk +@@ -20,10 +20,11 @@ FREETYPEINC = /usr/include/freetype2 + # 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 --git c/dwm.c w/dwm.c +index 3b19c82..7e78693 100644 +--- c/dwm.c ++++ w/dwm.c +@@ -41,6 +41,12 @@ + #include <X11/extensions/Xinerama.h> + #endif /* XINERAMA */ + #include <X11/Xft/Xft.h> ++#include <X11/Xlib-xcb.h> ++#include <xcb/res.h> ++#ifdef __OpenBSD__ ++#include <sys/sysctl.h> ++#include <kvm.h> ++#endif /* __OpenBSD */ + + #include "drw.h" + #include "util.h" +@@ -92,9 +98,11 @@ struct Client { + 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; + }; +@@ -139,6 +147,8 @@ typedef struct { + const char *title; + unsigned int tags; + int isfloating; ++ int isterminal; ++ int noswallow; + int monitor; + } Rule; + +@@ -245,6 +255,12 @@ static void bstackhoriz(Monitor *m); + static void centeredmaster(Monitor *m); + static void centeredfloatingmaster(Monitor *m); + ++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"; + static char stext[256]; +@@ -279,6 +295,8 @@ static Drw *drw; + static Monitor *mons, *selmon; + static Window root, wmcheckwin; + ++static xcb_connection_t *xcon; ++ + /* configuration, allows nested code to access above variables */ + #include "config.h" + +@@ -310,6 +328,8 @@ applyrules(Client *c) + && (!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); +@@ -428,6 +448,53 @@ attachstack(Client *c) + c->mon->stack = c; + } + ++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) + { +@@ -668,6 +735,9 @@ destroynotify(XEvent *e) + + if ((c = wintoclient(ev->window))) + unmanage(c, 1); ++ ++ else if ((c = swallowingclient(ev->window))) ++ unmanage(c->swallowing, 1); + } + + void +@@ -1076,12 +1146,13 @@ killclient(const Arg *arg) + 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; +@@ -1096,6 +1167,7 @@ manage(Window w, XWindowAttributes *wa) + } else { + c->mon = selmon; + applyrules(c); ++ term = termforwin(c); + } + + if (c->x + WIDTH(c) > c->mon->wx + c->mon->ww) +@@ -1138,6 +1210,8 @@ manage(Window w, XWindowAttributes *wa) + c->mon->sel = c; + arrange(c->mon); + XMapWindow(dpy, c->win); ++ if (term) ++ swallow(term, c); + focus(NULL); + } + +@@ -1920,6 +1994,20 @@ unmanage(Client *c, int destroyed) + 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) { +@@ -1935,9 +2023,12 @@ unmanage(Client *c, int destroyed) + XUngrabServer(dpy); + } + free(c); +- focus(NULL); +- updateclientlist(); +- arrange(m); ++ ++ if (!s) { ++ arrange(m); ++ focus(NULL); ++ updateclientlist(); ++ } + } + + void +@@ -2201,6 +2292,136 @@ view(const Arg *arg) + 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; ++} ++ + Client * + wintoclient(Window w) + { +@@ -2290,10 +2511,12 @@ main(int argc, char *argv[]) + 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(); + 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/x11-wm/dwm/files/07_bulkkill.diff b/x11-wm/dwm/files/07_bulkkill.diff new file mode 100644 index 0000000..e8f25be --- /dev/null +++ b/x11-wm/dwm/files/07_bulkkill.diff @@ -0,0 +1,70 @@ +diff --git c/config.def.h w/config.def.h +index 1a9ab69..1f69eef 100644 +--- c/config.def.h ++++ w/config.def.h +@@ -91,6 +91,8 @@ static const Key keys[] = { + { MODKEY|ShiftMask, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, ++ { MODKEY|ControlMask, XK_c, killclient, {.ui = 1} }, // kill unselect ++ { MODKEY|ShiftMask|ControlMask, XK_c, killclient, {.ui = 2} }, // killall + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, /* tatami */ + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, /* floating */ + { MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[2]} }, /* tile */ +diff --git c/dwm.c w/dwm.c +index 7e78693..d789241 100644 +--- c/dwm.c ++++ w/dwm.c +@@ -189,6 +189,7 @@ static void grabbuttons(Client *c, int focused); + static void grabkeys(void); + static void incnmaster(const Arg *arg); + static void keypress(XEvent *e); ++static void killthis(Client *c); + static void killclient(const Arg *arg); + static void manage(Window w, XWindowAttributes *wa); + static void mappingnotify(XEvent *e); +@@ -1128,21 +1129,38 @@ keypress(XEvent *e) + } + + void +-killclient(const Arg *arg) +-{ +- if (!selmon->sel) +- return; +- if (!sendevent(selmon->sel, wmatom[WMDelete])) { ++killthis(Client *c) { ++ if (!sendevent(c, wmatom[WMDelete])) { + XGrabServer(dpy); + XSetErrorHandler(xerrordummy); + XSetCloseDownMode(dpy, DestroyAll); +- XKillClient(dpy, selmon->sel->win); ++ XKillClient(dpy, c->win); + XSync(dpy, False); + XSetErrorHandler(xerror); + XUngrabServer(dpy); + } + } + ++void ++killclient(const Arg *arg) ++{ ++ Client *c; ++ ++ if (!selmon->sel) ++ return; ++ ++ if (!arg->ui || arg->ui == 0) { ++ killthis(selmon->sel); ++ return; ++ } ++ ++ for (c = selmon->clients; c; c = c->next) { ++ if (!ISVISIBLE(c) || (arg->ui == 1 && c == selmon->sel)) ++ continue; ++ killthis(c); ++ } ++} ++ + void + manage(Window w, XWindowAttributes *wa) + { diff --git a/x11-wm/dwm/files/50_larger-font.diff b/x11-wm/dwm/files/50_larger-font.diff index 7aa314e..0128799 100644 --- a/x11-wm/dwm/files/50_larger-font.diff +++ b/x11-wm/dwm/files/50_larger-font.diff @@ -1,9 +1,9 @@ -diff --git i/config.def.h w/config.def.h -index aabe6c0..4503e5d 100644 ---- i/config.def.h -+++ w/config.def.h -@@ -5,8 +5,8 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ - static const unsigned int snap = 32; /* snap pixel */ +diff --git c/config.def.h i/config.def.h +index a7a653c..91d1e9e 100644 +--- c/config.def.h ++++ i/config.def.h +@@ -6,8 +6,8 @@ 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" }; diff --git a/x11-wm/dwm/files/51_colors.diff b/x11-wm/dwm/files/51_colors.diff index bc543d6..03b9612 100644 --- a/x11-wm/dwm/files/51_colors.diff +++ b/x11-wm/dwm/files/51_colors.diff @@ -1,8 +1,8 @@ -diff --git i/config.def.h w/config.def.h -index 4503e5d..19a0c61 100644 ---- i/config.def.h -+++ w/config.def.h -@@ -7,15 +7,16 @@ static const int showbar = 1; /* 0 means no bar */ +diff --git c/config.def.h i/config.def.h +index 91d1e9e..5c2382f 100644 +--- c/config.def.h ++++ i/config.def.h +@@ -8,15 +8,16 @@ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ static const char *fonts[] = { "monospace:size=20" }; static const char dmenufont[] = "monospace:size=20"; @@ -21,7 +21,7 @@ index 4503e5d..19a0c61 100644 /* fg bg border */ - [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, - [SchemeSel] = { col_gray4, col_cyan, col_cyan }, -+ [SchemeNorm] = { col_white, col_black, col_black }, ++ [SchemeNorm] = { col_white, col_black, col_hblack }, + [SchemeSel] = { col_hwhite, col_purple, col_blue }, }; diff --git a/x11-wm/dwm/files/52_keys.diff b/x11-wm/dwm/files/52_keys.diff index aa0eaab..9e53a74 100644 --- a/x11-wm/dwm/files/52_keys.diff +++ b/x11-wm/dwm/files/52_keys.diff @@ -1,16 +1,14 @@ -diff --git i/config.def.h w/config.def.h -index 19a0c61..0267c5e 100644 ---- i/config.def.h -+++ w/config.def.h -@@ -1,5 +1,7 @@ +diff --git c/config.def.h i/config.def.h +index 5c2382f..25d4265 100644 +--- c/config.def.h ++++ i/config.def.h +@@ -1,4 +1,5 @@ /* See LICENSE file for copyright and license details. */ - +#include <X11/XF86keysym.h> -+ + /* appearance */ static const unsigned int borderpx = 1; /* border pixel of windows */ - static const unsigned int snap = 32; /* snap pixel */ -@@ -58,14 +60,33 @@ static const Layout layouts[] = { +@@ -68,16 +69,35 @@ static const Layout layouts[] = { #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } /* commands */ @@ -18,8 +16,10 @@ index 19a0c61..0267c5e 100644 -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 char dmenumon[2] = "0"; /* component of dmenu_cmd, manipulated in spawn() */ -+static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL }; -+static const char *termcmd[] = { "st", NULL }; ++static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL }; ++static const char *termcmd[] = { "st", NULL }; + static const char scratchpadname[] = "scratchpad"; + static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL }; +static const char *browser_cmd[] = { "librewolf", NULL }; +static const char *files_cmd[] = { "true", NULL }; /* WIP */ +static const char *mail_cmd[] = { "st", "-e", "neomutt", NULL }; @@ -35,16 +35,16 @@ index 19a0c61..0267c5e 100644 /* modifier key function argument */ { MODKEY, XK_p, spawn, {.v = dmenucmd } }, - { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, -+ { MODKEY, XK_q, spawn, {.v = music_cmd } }, -+ { MODKEY|ShiftMask, XK_q, spawn, {.v = mixer_cmd } }, ++ { MODKEY, XK_a, spawn, {.v = music_cmd } }, ++ { MODKEY|ShiftMask, XK_a, spawn, {.v = mixer_cmd } }, + { MODKEY, XK_s, spawn, {.v = termcmd } }, + { MODKEY, XK_w, spawn, {.v = browser_cmd } }, + { MODKEY|ShiftMask, XK_w, spawn, {.v = wlan_scan_cmd } }, + { MODKEY, XK_e, spawn, {.v = files_cmd } }, + { MODKEY, XK_r, spawn, {.v = mail_cmd } }, -+ { 0, XF86XK_AudioRaiseVolume, spawn, { .v = vol_up } }, -+ { 0, XF86XK_AudioLowerVolume, spawn, { .v = vol_down } }, -+ { 0, XF86XK_AudioMute, spawn, { .v = vol_mute } }, ++ { 0, XF86XK_AudioRaiseVolume, spawn, {.v = vol_up } }, ++ { 0, XF86XK_AudioLowerVolume, spawn, {.v = vol_down } }, ++ { 0, XF86XK_AudioMute, spawn, {.v = vol_mute } }, + { MODKEY|ShiftMask, XK_s, togglescratch, {.v = scratchpadcmd } }, { MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_j, focusstack, {.i = +1 } }, - { MODKEY, XK_k, focusstack, {.i = -1 } }, |