diff options
author | Joe <rbo@gmx.us> | 2024-12-19 15:06:27 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-12-19 15:06:27 +0100 |
commit | 03765f41f101502e9825047419fa9d8667e710ea (patch) | |
tree | cef6445d9c3df3081aed9f8cd28555ecfd88e401 /applied | |
parent | conflict (diff) | |
download | dwm-03765f41f101502e9825047419fa9d8667e710ea.tar.gz dwm-03765f41f101502e9825047419fa9d8667e710ea.tar.bz2 dwm-03765f41f101502e9825047419fa9d8667e710ea.tar.xz dwm-03765f41f101502e9825047419fa9d8667e710ea.tar.zst dwm-03765f41f101502e9825047419fa9d8667e710ea.zip |
6.5
Diffstat (limited to '')
-rw-r--r-- | applied/dwm-6.0-winview.diff | 65 | ||||
-rw-r--r-- | applied/dwm-attachasideandbelow-6.4.diff (renamed from applied/dwm-attachasideandbelow-20200702-f04cac6.diff) | 34 | ||||
-rw-r--r-- | applied/dwm-bar-height-6.2.diff | 25 | ||||
-rw-r--r-- | applied/dwm-dash_above_activeWindow-20240604-061e9fe.diff | 44 | ||||
-rw-r--r-- | applied/dwm-foreground-20240220-9f88553.diff | 180 | ||||
-rw-r--r-- | applied/dwm-fullgaps-6.4.diff (renamed from applied/dwm-fullgaps-20200508-7b77734.diff) | 87 | ||||
-rw-r--r-- | applied/dwm-nrowgrid-6.1.diff | 77 | ||||
-rw-r--r-- | applied/dwm-preventfocusshift-20240831-6.5.diff | 25 | ||||
-rw-r--r-- | applied/dwm-sizehints-isfreesize-6.2.diff | 103 | ||||
-rw-r--r-- | applied/dwm-stairs-fullgaps-20220430-8b48e30.diff | 98 | ||||
-rw-r--r-- | applied/dwm-swallow-6.3.diff | 412 | ||||
-rw-r--r-- | applied/dwm-switchtotag-6.2.diff | 58 | ||||
-rw-r--r-- | applied/dwm-systray-20230922-9f88553.diff (renamed from applied/dwm-systray-6.4.diff) | 79 |
13 files changed, 891 insertions, 396 deletions
diff --git a/applied/dwm-6.0-winview.diff b/applied/dwm-6.0-winview.diff new file mode 100644 index 0000000..1b796b5 --- /dev/null +++ b/applied/dwm-6.0-winview.diff @@ -0,0 +1,65 @@ +diff --git a/config.def.h b/config.def.h +index 77ff358..3ba0efe 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -84,6 +84,7 @@ static Key keys[] = { + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask, XK_q, quit, {0} }, ++ { MODKEY, XK_o, winview, {0} }, + }; + + /* button definitions */ +diff --git a/dwm.1 b/dwm.1 +index 5268a06..1188c82 100644 +--- a/dwm.1 ++++ b/dwm.1 +@@ -104,6 +104,9 @@ Increase master area size. + .B Mod1\-h + Decrease master area size. + .TP ++.B Mod1\-o ++Select view of the window in focus. The list of tags to be displayed is matched to the window tag list. ++.TP + .B Mod1\-Return + Zooms/cycles focused window to/from master area (tiled layouts only). + .TP +diff --git a/dwm.c b/dwm.c +index 1d78655..abf944c 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -247,6 +247,7 @@ static void updatewmhints(Client *c); + static void view(const Arg *arg); + static Client *wintoclient(Window w); + static Monitor *wintomon(Window w); ++static void winview(const Arg* arg); + static int xerror(Display *dpy, XErrorEvent *ee); + static int xerrordummy(Display *dpy, XErrorEvent *ee); + static int xerrorstart(Display *dpy, XErrorEvent *ee); +@@ -2080,6 +2081,26 @@ wintomon(Window w) { + return selmon; + } + ++/* Selects for the view of the focused window. The list of tags */ ++/* to be displayed is matched to the focused window tag list. */ ++void ++winview(const Arg* arg){ ++ Window win, win_r, win_p, *win_c; ++ unsigned nc; ++ int unused; ++ Client* c; ++ Arg a; ++ ++ if (!XGetInputFocus(dpy, &win, &unused)) return; ++ while(XQueryTree(dpy, win, &win_r, &win_p, &win_c, &nc) ++ && win_p != win_r) win = win_p; ++ ++ if (!(c = wintoclient(win))) return; ++ ++ a.ui = c->tags; ++ view(&a); ++} ++ + /* There's no way to check accesses to destroyed windows, thus those cases are + * ignored (especially on UnmapNotify's). Other types of errors call Xlibs + * default error handler, which may call exit. */ diff --git a/applied/dwm-attachasideandbelow-20200702-f04cac6.diff b/applied/dwm-attachasideandbelow-6.4.diff index 1b9219d..326f757 100644 --- a/applied/dwm-attachasideandbelow-20200702-f04cac6.diff +++ b/applied/dwm-attachasideandbelow-6.4.diff @@ -1,6 +1,7 @@ -diff -up b/dwm.c a/dwm.c ---- b/dwm.c 2020-07-05 16:05:02.555947738 -0300 -+++ a/dwm.c 2020-07-05 16:06:19.592609932 -0300 +diff --git a/dwm.c b/dwm.c +index e5efb6a..7b8d4a0 100644 +--- a/dwm.c ++++ b/dwm.c @@ -49,7 +49,8 @@ #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)) \ @@ -11,7 +12,7 @@ diff -up b/dwm.c a/dwm.c #define LENGTH(X) (sizeof X / sizeof X[0]) #define MOUSEMASK (BUTTONMASK|PointerMotionMask) #define WIDTH(X) ((X)->w + 2 * (X)->bw) -@@ -147,6 +148,7 @@ static int applysizehints(Client *c, int +@@ -147,6 +148,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac static void arrange(Monitor *m); static void arrangemon(Monitor *m); static void attach(Client *c); @@ -25,9 +26,9 @@ diff -up b/dwm.c a/dwm.c static void movemouse(const Arg *arg); +static Client *nexttagged(Client *c); static Client *nexttiled(Client *c); - static void pop(Client *); + static void pop(Client *c); static void propertynotify(XEvent *e); -@@ -406,6 +409,27 @@ attach(Client *c) +@@ -408,6 +411,27 @@ attach(Client *c) c->next = c->mon->clients; c->mon->clients = c; } @@ -55,7 +56,7 @@ diff -up b/dwm.c a/dwm.c void attachstack(Client *c) -@@ -1063,7 +1087,7 @@ manage(Window w, XWindowAttributes *wa) +@@ -1065,7 +1089,7 @@ manage(Window w, XWindowAttributes *wa) c->isfloating = c->oldstate = trans != None || c->isfixed; if (c->isfloating) XRaiseWindow(dpy, c->win); @@ -90,11 +91,14 @@ diff -up b/dwm.c a/dwm.c attachstack(c); focus(NULL); arrange(NULL); -@@ -1901,6 +1935,7 @@ updategeom(void) - detachstack(c); - c->mon = mons; - attach(c); -+ attachBelow(c); - attachstack(c); - } - if (m == selmon) +@@ -1898,6 +1932,7 @@ updategeom(void) + detachstack(c); + c->mon = mons; + attach(c); ++ attachBelow(c); + attachstack(c); + } + if (m == selmon) +-- +2.41.0 + diff --git a/applied/dwm-bar-height-6.2.diff b/applied/dwm-bar-height-6.2.diff deleted file mode 100644 index a576111..0000000 --- a/applied/dwm-bar-height-6.2.diff +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 1c0b587..9814500 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -5,6 +5,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ - static const unsigned int snap = 32; /* snap pixel */ - static const int showbar = 1; /* 0 means no bar */ - static const int topbar = 1; /* 0 means bottom bar */ -+static const int user_bh = 0; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */ - static const char *fonts[] = { "monospace:size=10" }; - static const char dmenufont[] = "monospace:size=10"; - static const char col_gray1[] = "#222222"; -diff --git a/dwm.c b/dwm.c -index 4465af1..2c27cb3 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -1545,7 +1545,7 @@ setup(void) - if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) - die("no fonts could be loaded."); - lrpad = drw->fonts->h; -- bh = drw->fonts->h + 2; -+ bh = user_bh ? user_bh : drw->fonts->h + 2; - updategeom(); - /* init atoms */ - utf8string = XInternAtom(dpy, "UTF8_STRING", False); diff --git a/applied/dwm-dash_above_activeWindow-20240604-061e9fe.diff b/applied/dwm-dash_above_activeWindow-20240604-061e9fe.diff new file mode 100644 index 0000000..4d66f6c --- /dev/null +++ b/applied/dwm-dash_above_activeWindow-20240604-061e9fe.diff @@ -0,0 +1,44 @@ +From 89303c44ed3c65e106f7e2e7711c112867226695 Mon Sep 17 00:00:00 2001 +From: DonRehan <30264386+donRehan@users.noreply.github.com> +Date: Tue, 4 Jun 2024 04:33:48 +0300 +Subject: [PATCH] Add a dash above current active window in dwm bar + +Give user ability to modify its position , width and text position. +--- + config.def.h | 3 +++ + dwm.c | 4 +++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/config.def.h b/config.def.h +index 9efa774..2ec5f52 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -2,6 +2,9 @@ + + /* appearance */ + static const unsigned int borderpx = 1; /* border pixel of windows */ ++static const unsigned int brdsh_w = 2; /* width of the app bar dash */ ++static const unsigned int brdsh_ypos = 18; /* y-position of the dash */ ++static const unsigned int text_ypos = 1; /* y-position of text */ + static const unsigned int snap = 32; /* snap pixel */ + static const int showbar = 1; /* 0 means no bar */ + static const int topbar = 1; /* 0 means bottom bar */ +diff --git a/dwm.c b/dwm.c +index f1d86b2..3c9b293 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -736,8 +736,10 @@ drawbar(Monitor *m) + + if ((w = m->ww - tw - x) > bh) { + if (m->sel) { ++ drw_setscheme(drw, scheme[SchemeNorm]); ++ drw_text(drw, x, text_ypos, w, bh, lrpad / 2, m->sel->name, 0); + drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); +- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); ++ drw_rect(drw, x , bh - brdsh_ypos , w , brdsh_w , 1, 1); + if (m->sel->isfloating) + drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); + } else { +-- +2.34.1 + diff --git a/applied/dwm-foreground-20240220-9f88553.diff b/applied/dwm-foreground-20240220-9f88553.diff new file mode 100644 index 0000000..d5e4502 --- /dev/null +++ b/applied/dwm-foreground-20240220-9f88553.diff @@ -0,0 +1,180 @@ +From 507895940574e77386d53f81df541e3903bf1ba3 Mon Sep 17 00:00:00 2001 +From: espro1 <ericspero@icloud.com> +Date: Tue, 20 Feb 2024 16:11:05 -0500 +Subject: [PATCH] Essentially a layout for a special class of floating windows. + When a window is foregrounded, it is floated, resized, and moved to a + predictable location + +--- + config.def.h | 3 ++ + dwm.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 84 insertions(+), 1 deletion(-) + +diff --git a/config.def.h b/config.def.h +index 9efa774..718e7c3 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -37,6 +37,8 @@ static const int nmaster = 1; /* number of clients in master area */ + static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ + static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ + ++static const float fgw = .6,fgh = .6; ++ + static const Layout layouts[] = { + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ +@@ -78,6 +80,7 @@ static const Key keys[] = { + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, ++ { MODKEY|Mod4Mask, XK_space, toggleforegrounded, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, +diff --git a/dwm.c b/dwm.c +index f1d86b2..12b037d 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -92,9 +92,10 @@ 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, isforegrounded; + Client *next; + Client *snext; ++ Client *tnext; + Monitor *mon; + Window win; + }; +@@ -127,6 +128,7 @@ struct Monitor { + Client *clients; + Client *sel; + Client *stack; ++ Client *foregrounded; + Monitor *next; + Window barwin; + const Layout *lt[2]; +@@ -210,6 +212,7 @@ static void tag(const Arg *arg); + static void tagmon(const Arg *arg); + static void tile(Monitor *m); + static void togglebar(const Arg *arg); ++static void toggleforegrounded(const Arg *arg); + static void togglefloating(const Arg *arg); + static void toggletag(const Arg *arg); + static void toggleview(const Arg *arg); +@@ -415,6 +418,21 @@ attachstack(Client *c) + c->mon->stack = c; + } + ++void ++attachforegrounded (Client *c) ++{ ++ c->tnext = c->mon->foregrounded; ++ c->mon->foregrounded = c; ++} ++ ++void ++detachforegrounded (Client *c) ++{ ++ Client **tc; ++ for (tc = &c->mon->foregrounded; *tc && *tc != c; tc = &(*tc)->tnext); ++ *tc = c->tnext; ++} ++ + void + buttonpress(XEvent *e) + { +@@ -1209,6 +1227,39 @@ nexttiled(Client *c) + return c; + } + ++Client * ++nextforegrounded(Client *c) ++{ ++ for (; c && (!c->isforegrounded || !ISVISIBLE(c)); c = c->tnext); ++ return c; ++} ++ ++void ++arrangeforegrounded (Monitor *m) ++{ ++ unsigned int n,i,x,y,w,h; ++ Client *c; ++ ++ for (n = 0, c = nextforegrounded(m->foregrounded); c; c = nextforegrounded(c->tnext), n++); ++ if (n == 0) ++ return; ++ ++ for (i = 0, c = nextforegrounded(m->foregrounded); c; c = nextforegrounded(c->tnext), i++){ ++ if (n == 1) { ++ x = m->mx + (m->mw - m->mw * fgw) / 2; ++ y = m->my + (m->mh - m->mh * fgh) / 2; ++ w = (m->mw * fgw) - (2 * (m->foregrounded->bw)); ++ h = (m->mh * fgh) - (2 * (m->foregrounded->bw)); ++ } else { ++ x = (n - 1 - i) * (m->mw / n); ++ y = m->my + (m->mh - m->mh * fgh) / 2; ++ w = (m->mw * (1 / (float)n)) - (2 * (m->foregrounded->bw)); ++ h = (m->mh * fgh) - (2 * (m->foregrounded->bw)); ++ } ++ resize(c,x,y,w,h,0); ++ } ++} ++ + void + pop(Client *c) + { +@@ -1721,6 +1772,24 @@ togglebar(const Arg *arg) + arrange(selmon); + } + ++void ++toggleforegrounded(const Arg *arg) ++{ ++ if (!selmon->sel) ++ return; ++ if (selmon->sel->isfullscreen) /* no support for fullscreen windows */ ++ return; ++ ++ selmon->sel->isforegrounded || selmon->sel->isfloating ? ++ detachforegrounded(selmon->sel) : attachforegrounded(selmon->sel); ++ ++ selmon->sel->isforegrounded = selmon->sel->isfloating = ++ !selmon->sel->isfloating && !selmon->sel->isforegrounded; ++ ++ arrangeforegrounded(selmon); ++ arrange(selmon); ++} ++ + void + togglefloating(const Arg *arg) + { +@@ -1732,6 +1801,11 @@ togglefloating(const Arg *arg) + if (selmon->sel->isfloating) + resize(selmon->sel, selmon->sel->x, selmon->sel->y, + selmon->sel->w, selmon->sel->h, 0); ++ if (selmon->sel->isforegrounded) { ++ selmon->sel->isforegrounded = 0; ++ detachforegrounded(selmon->sel); ++ arrangeforegrounded(selmon); ++ } + arrange(selmon); + } + +@@ -1783,6 +1857,12 @@ unmanage(Client *c, int destroyed) + + detach(c); + detachstack(c); ++ ++ if (c->isforegrounded){ ++ detachforegrounded(c); ++ arrangeforegrounded(m); ++ } ++ + if (!destroyed) { + wc.border_width = c->oldbw; + XGrabServer(dpy); /* avoid race conditions */ +-- +2.43.0 + diff --git a/applied/dwm-fullgaps-20200508-7b77734.diff b/applied/dwm-fullgaps-6.4.diff index 29bd6dc..dc52139 100644 --- a/applied/dwm-fullgaps-20200508-7b77734.diff +++ b/applied/dwm-fullgaps-6.4.diff @@ -1,41 +1,27 @@ -From 7b7773458c072e4b24d6ea32d0364a8e402e4a43 Mon Sep 17 00:00:00 2001 -From: swy7ch <swy7ch@protonmail.com> -Date: Fri, 8 May 2020 19:07:24 +0200 -Subject: [PATCH] [PATCH] update dwm-fullgaps patch to be used with tile layout - update - -the recent tile layout changes in commit HEAD~1 (f09418b) broke the -patch - -this patch adapt the new `if` statements to take gaps into account - -this patch also provides manpage entries for the keybindings ---- -diff --git a/dwm.1 b/dwm.1 -index 13b3729..0202d96 100644 ---- a/dwm.1 -+++ b/dwm.1 -@@ -140,6 +140,16 @@ View all windows with any tag. - .B Mod1\-Control\-[1..n] - Add/remove all windows with nth tag to/from the view. - .TP -+.B Mod1\-- -+Decrease the gaps around windows. -+.TP -+.B Mod1\-= -+Increase the gaps around windows. -+.TP -+.B Mod1\-Shift-= -+Reset the gaps around windows to -+.BR 0 . -+.TP - .B Mod1\-Shift\-q - Quit dwm. - .SS Mouse commands -diff --git a/dwm.c b/dwm.c -index 9fd0286..45a58f3 100644 ---- a/dwm.c -+++ b/dwm.c +diff -up a/config.def.h b/config.def.h +--- a/config.def.h ++++ b/config.def.h +@@ -2,6 +2,7 @@ + + /* appearance */ + static const unsigned int borderpx = 1; /* border pixel of windows */ ++static const unsigned int gappx = 5; /* gaps between windows */ + static const unsigned int snap = 32; /* snap pixel */ + static const int showbar = 1; /* 0 means no bar */ + static const int topbar = 1; /* 0 means bottom bar */ +@@ -85,6 +86,9 @@ static const Key keys[] = { + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, ++ { MODKEY, XK_minus, setgaps, {.i = -1 } }, ++ { MODKEY, XK_equal, setgaps, {.i = +1 } }, ++ { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) +diff -up a/dwm.c b/dwm.c +--- a/dwm.c 2023-04-30 ++++ b/dwm.c 2023-04-30 @@ -119,6 +119,7 @@ struct Monitor { int by; /* bar geometry */ int mx, my, mw, mh; /* screen size */ @@ -44,7 +30,7 @@ index 9fd0286..45a58f3 100644 unsigned int seltags; unsigned int sellt; unsigned int tagset[2]; -@@ -200,6 +201,7 @@ static void sendmon(Client *c, Monitor *m); +@@ -200,6 +201,7 @@ static void sendmon(Client *c, Monitor * static void setclientstate(Client *c, long state); static void setfocus(Client *c); static void setfullscreen(Client *c, int fullscreen); @@ -52,7 +38,7 @@ index 9fd0286..45a58f3 100644 static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); static void setup(void); -@@ -639,6 +641,7 @@ createmon(void) +@@ -641,6 +643,7 @@ createmon(void) m->nmaster = nmaster; m->showbar = showbar; m->topbar = topbar; @@ -60,11 +46,10 @@ index 9fd0286..45a58f3 100644 m->lt[0] = &layouts[0]; m->lt[1] = &layouts[1 % LENGTH(layouts)]; strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); -@@ -1498,6 +1501,16 @@ setfullscreen(Client *c, int fullscreen) - } +@@ -1508,6 +1511,16 @@ setfullscreen(Client *c, int fullscreen) } -+void + void +setgaps(const Arg *arg) +{ + if ((arg->i == 0) || (selmon->gappx + arg->i < 0)) @@ -74,22 +59,24 @@ index 9fd0286..45a58f3 100644 + arrange(selmon); +} + - void ++void setlayout(const Arg *arg) { -@@ -1684,18 +1697,18 @@ tile(Monitor *m) + if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) +@@ -1697,18 +1710,18 @@ tile(Monitor *m) if (n > m->nmaster) mw = m->nmaster ? m->ww * m->mfact : 0; else - mw = m->ww; - for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) -+ mw = m->ww - m->gappx; -+ for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) - if (i < m->nmaster) { +- 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), 0); - if (my + HEIGHT(c) < m->wh) - my += HEIGHT(c); ++ mw = m->ww - m->gappx; ++ for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) ++ if (i < m->nmaster) { + h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx; + resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0); + if (my + HEIGHT(c) + m->gappx < m->wh) @@ -105,7 +92,3 @@ index 9fd0286..45a58f3 100644 + ty += HEIGHT(c) + m->gappx; } } - --- -2.26.2 - diff --git a/applied/dwm-nrowgrid-6.1.diff b/applied/dwm-nrowgrid-6.1.diff new file mode 100644 index 0000000..e2e6505 --- /dev/null +++ b/applied/dwm-nrowgrid-6.1.diff @@ -0,0 +1,77 @@ +Author: Chris Noxz <chris@noxz.tech> + +diff -upN dwm-6.1/config.def.h dwm-nrowgrid-6.1/config.def.h +--- dwm-6.1/config.def.h 2015-11-08 23:11:48.000000000 +0100 ++++ dwm-nrowgrid-6.1/config.def.h 2018-10-01 10:44:05.631382842 +0200 +@@ -34,11 +34,15 @@ static const float mfact = 0.55; /* + static const int nmaster = 1; /* number of clients in master area */ + static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ + ++#define FORCE_VSPLIT 1 ++#include "nrowgrid.c" ++ + static const Layout layouts[] = { + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, ++ { "###", nrowgrid }, + }; + + /* key definitions */ +diff -upN dwm-6.1/nrowgrid.c dwm-nrowgrid-6.1/nrowgrid.c +--- dwm-6.1/nrowgrid.c 1970-01-01 01:00:00.000000000 +0100 ++++ dwm-nrowgrid-6.1/nrowgrid.c 2018-10-01 10:44:27.741263063 +0200 +@@ -0,0 +1,52 @@ ++void ++nrowgrid(Monitor *m) ++{ ++ unsigned int n = 0, i = 0, ri = 0, ci = 0; /* counters */ ++ unsigned int cx, cy, cw, ch; /* client geometry */ ++ unsigned int uw = 0, uh = 0, uc = 0; /* utilization trackers */ ++ unsigned int cols, rows = m->nmaster + 1; ++ Client *c; ++ ++ /* count clients */ ++ for (c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ ++ /* nothing to do here */ ++ if (n == 0) ++ return; ++ ++ /* force 2 clients to always split vertically */ ++ if (FORCE_VSPLIT && n == 2) ++ rows = 1; ++ ++ /* never allow empty rows */ ++ if (n < rows) ++ rows = n; ++ ++ /* define first row */ ++ cols = n / rows; ++ uc = cols; ++ cy = m->wy; ++ ch = m->wh / rows; ++ uh = ch; ++ ++ for (c = nexttiled(m->clients); c; c = nexttiled(c->next), i++, ci++) { ++ if (ci == cols) { ++ uw = 0; ++ ci = 0; ++ ri++; ++ ++ /* next row */ ++ cols = (n - uc) / (rows - ri); ++ uc += cols; ++ cy = m->wy + uh; ++ ch = (m->wh - uh) / (rows - ri); ++ uh += ch; ++ } ++ ++ cx = m->wx + uw; ++ cw = (m->ww - uw) / (cols - ci); ++ uw += cw; ++ ++ resize(c, cx, cy, cw - 2 * c->bw, ch - 2 * c->bw, 0); ++ } ++} diff --git a/applied/dwm-preventfocusshift-20240831-6.5.diff b/applied/dwm-preventfocusshift-20240831-6.5.diff new file mode 100644 index 0000000..78a24cb --- /dev/null +++ b/applied/dwm-preventfocusshift-20240831-6.5.diff @@ -0,0 +1,25 @@ +From 554f5a8a2205a7c52280babf5685462d8991b038 Mon Sep 17 00:00:00 2001 +From: Suleyman Farajli <suleyman@farajli.net> +Date: Sat, 31 Aug 2024 13:34:58 +0400 +Subject: [PATCH] prevent focus shifting when a window is spawned in fullscreen + +--- + dwm.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/dwm.c b/dwm.c +index f1d86b2..31b5d07 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -1080,6 +1080,8 @@ manage(Window w, XWindowAttributes *wa) + (unsigned char *) &(c->win), 1); + XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */ + setclientstate(c, NormalState); ++ if(selmon->sel && selmon->sel->isfullscreen && !c->isfloating) ++ setfullscreen(selmon->sel, 0); + if (c->mon == selmon) + unfocus(selmon->sel, 0); + c->mon->sel = c; +-- +2.44.2 + diff --git a/applied/dwm-sizehints-isfreesize-6.2.diff b/applied/dwm-sizehints-isfreesize-6.2.diff deleted file mode 100644 index bd9e5da..0000000 --- a/applied/dwm-sizehints-isfreesize-6.2.diff +++ /dev/null @@ -1,103 +0,0 @@ -From 5d4e92801206d47090236498d35f199e46dd07f6 Mon Sep 17 00:00:00 2001 -From: MLquest8 <miskuzius@gmail.com> -Date: Sat, 20 Jun 2020 15:40:43 +0400 -Subject: [PATCH] sizehints-ruled now with a separate rule "isfreesize" and - cleaner code. - ---- - config.def.h | 8 +++++--- - dwm.c | 16 +++++++++++++--- - 2 files changed, 18 insertions(+), 6 deletions(-) - -diff --git a/config.def.h b/config.def.h -index 1c0b587..0e4a5ea 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -26,9 +26,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 isfreesize monitor */ -+ { "Gimp", NULL, NULL, 0, 1, 1, -1 }, -+ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 }, -+ { "st", NULL, NULL, 0, 0, 0, -1 }, -+ { "St", NULL, NULL, 0, 0, 0, -1 }, /* St with Xresources patch */ - }; - - /* layout(s) */ -diff --git a/dwm.c b/dwm.c -index 9fd0286..73825d1 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -92,7 +92,7 @@ struct Client { - int basew, baseh, incw, inch, maxw, maxh, minw, minh; - int bw, oldbw; - unsigned int tags; -- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; -+ int isfixed, isfloating, isfreesize, isurgent, neverfocus, oldstate, isfullscreen; - Client *next; - Client *snext; - Monitor *mon; -@@ -138,6 +138,7 @@ typedef struct { - const char *title; - unsigned int tags; - int isfloating; -+ int isfreesize; - int monitor; - } Rule; - -@@ -287,6 +288,7 @@ applyrules(Client *c) - - /* rule matching */ - c->isfloating = 0; -+ c->isfreesize = 1; - c->tags = 0; - XGetClassHint(dpy, c->win, &ch); - class = ch.res_class ? ch.res_class : broken; -@@ -299,6 +301,7 @@ applyrules(Client *c) - && (!r->instance || strstr(instance, r->instance))) - { - c->isfloating = r->isfloating; -+ c->isfreesize = r->isfreesize; - c->tags |= r->tags; - for (m = mons; m && m->num != r->monitor; m = m->next); - if (m) -@@ -1952,7 +1955,7 @@ updatesizehints(Client *c) - - if (!XGetWMNormalHints(dpy, c->win, &size, &msize)) - /* size is uninitialized, ensure that size.flags aren't used */ -- size.flags = PSize; -+ size.flags = 0; - if (size.flags & PBaseSize) { - c->basew = size.base_width; - c->baseh = size.base_height; -@@ -1984,6 +1987,11 @@ updatesizehints(Client *c) - c->maxa = (float)size.max_aspect.x / size.max_aspect.y; - } else - c->maxa = c->mina = 0.0; -+ if((size.flags & PSize) && c->isfreesize) { -+ c->basew = size.base_width; -+ c->baseh = size.base_height; -+ c->isfloating = 1; -+ } - c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh); - } - -@@ -2012,8 +2020,10 @@ updatewindowtype(Client *c) - - if (state == netatom[NetWMFullscreen]) - setfullscreen(c, 1); -- if (wtype == netatom[NetWMWindowTypeDialog]) -+ if (wtype == netatom[NetWMWindowTypeDialog]) { - c->isfloating = 1; -+ c->isfreesize = 1; -+ } - } - - void --- -2.26.2 - diff --git a/applied/dwm-stairs-fullgaps-20220430-8b48e30.diff b/applied/dwm-stairs-fullgaps-20220430-8b48e30.diff deleted file mode 100644 index 53e7966..0000000 --- a/applied/dwm-stairs-fullgaps-20220430-8b48e30.diff +++ /dev/null @@ -1,98 +0,0 @@ -From 2004db267a9478918699961ab2f3579c2c8113fb Mon Sep 17 00:00:00 2001 -From: Ehsan Ghorbannezhad <ehsan@disroot.org> -Date: Sat, 30 Apr 2022 02:48:58 +0430 -Subject: [PATCH] add the stairs layout with fullgaps support - ---- - config.def.h | 5 +++++ - dwm.c | 38 ++++++++++++++++++++++++++++++++++++++ - 2 files changed, 43 insertions(+) - -diff --git a/config.def.h b/config.def.h -index 5b0d4de..c0f24f4 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -6,6 +6,9 @@ static const unsigned int gappx = 5; /* gaps between windows */ - static const unsigned int snap = 32; /* snap pixel */ - static const int showbar = 1; /* 0 means no bar */ - static const int topbar = 1; /* 0 means bottom bar */ -+static const unsigned int stairpx = 20; /* depth of the stairs layout */ -+static const int stairdirection = 1; /* 0: left-aligned, 1: right-aligned */ -+static const int stairsamesize = 1; /* 1 means shrink all the staired windows to the same size */ - static const char *fonts[] = { "monospace:size=10" }; - static const char dmenufont[] = "monospace:size=10"; - static const char col_gray1[] = "#222222"; -@@ -43,6 +46,7 @@ static const Layout layouts[] = { - { "[]=", tile }, /* first entry is default */ - { "><>", NULL }, /* no layout function means floating behavior */ - { "[M]", monocle }, -+ { "[S]", stairs }, - }; - - /* key definitions */ -@@ -78,6 +82,7 @@ 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_s, setlayout, {.v = &layouts[3]} }, - { 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 5b7348c..2c5380f 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -209,6 +209,7 @@ static void seturgent(Client *c, int urg); - static void showhide(Client *c); - static void sigchld(int unused); - static void spawn(const Arg *arg); -+static void stairs(Monitor *m); - static void tag(const Arg *arg); - static void tagmon(const Arg *arg); - static void tile(Monitor *); -@@ -1672,6 +1673,43 @@ spawn(const Arg *arg) - } - } - -+void -+stairs(Monitor *m) -+{ -+ unsigned int i, n, h, mw, my; -+ unsigned int ox, oy, ow, oh; /* stair offset values */ -+ 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; -+ else -+ mw = m->ww - m->gappx; -+ -+ for (i = 0, my = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { -+ if (i < m->nmaster) { -+ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx; -+ resize(c, m->wx + m->gappx, m->wy + my, mw - (2 * c->bw) - m->gappx, h - (2 * c->bw), 0); -+ if (my + HEIGHT(c) + m->gappx < m->wh) -+ my += HEIGHT(c) + m->gappx; -+ } else { -+ oy = i - m->nmaster; -+ ox = stairdirection ? n - i - 1 : (stairsamesize ? i - m->nmaster : 0); -+ ow = stairsamesize ? n - m->nmaster - 1 : n - i - 1; -+ oh = stairsamesize ? ow : i - m->nmaster; -+ resize(c, -+ m->wx + mw + (ox * stairpx) + m->gappx, -+ m->wy + (oy * stairpx) + m->gappx, -+ m->ww - mw - (2 * c->bw) - (ow * stairpx) - (2 * m->gappx), -+ m->wh - (2 * c->bw) - (oh * stairpx) - (2 * m->gappx), -+ 0); -+ } -+ } -+} -+ - void - tag(const Arg *arg) - { --- -2.36.0 diff --git a/applied/dwm-swallow-6.3.diff b/applied/dwm-swallow-6.3.diff new file mode 100644 index 0000000..47586a0 --- /dev/null +++ b/applied/dwm-swallow-6.3.diff @@ -0,0 +1,412 @@ +From 0cf9a007511f7dfd7dd94171b172562ebac9b6d5 Mon Sep 17 00:00:00 2001 +From: Tom Schwindl <schwindl@posteo.de> +Date: Sat, 10 Sep 2022 12:51:09 +0200 +Subject: [PATCH] 6.3 swallow patch + +--- + config.def.h | 9 +- + config.mk | 3 +- + dwm.c | 235 +++++++++++++++++++++++++++++++++++++++++++++++++-- + 3 files changed, 237 insertions(+), 10 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 061ad662f82a..0b2b8ffd30d5 100644 +--- a/config.def.h ++++ b/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" }; +@@ -26,9 +27,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 a/config.mk b/config.mk +index 81c493ef4aff..52d1ebf30bec 100644 +--- a/config.mk ++++ b/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_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} +diff --git a/dwm.c b/dwm.c +index e5efb6a22806..e68294b6b679 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -40,6 +40,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; + }; +@@ -138,6 +146,8 @@ typedef struct { + const char *title; + unsigned int tags; + int isfloating; ++ int isterminal; ++ int noswallow; + int monitor; + } Rule; + +@@ -235,6 +245,12 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee); + static int xerrorstart(Display *dpy, XErrorEvent *ee); + static void zoom(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"; + static char stext[256]; +@@ -269,6 +285,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" + +@@ -298,6 +316,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); +@@ -416,6 +436,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) + { +@@ -656,6 +723,9 @@ destroynotify(XEvent *e) + + if ((c = wintoclient(ev->window))) + unmanage(c, 1); ++ ++ else if ((c = swallowingclient(ev->window))) ++ unmanage(c->swallowing, 1); + } + + void +@@ -1022,12 +1092,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; +@@ -1042,6 +1113,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) +@@ -1076,6 +1148,8 @@ manage(Window w, XWindowAttributes *wa) + c->mon->sel = c; + arrange(c->mon); + XMapWindow(dpy, c->win); ++ if (term) ++ swallow(term, c); + focus(NULL); + } + +@@ -1763,6 +1837,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) { +@@ -1778,9 +1866,12 @@ unmanage(Client *c, int destroyed) + XUngrabServer(dpy); + } + free(c); +- focus(NULL); +- updateclientlist(); +- arrange(m); ++ ++ if (!s) { ++ arrange(m); ++ focus(NULL); ++ updateclientlist(); ++ } + } + + void +@@ -2044,6 +2135,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) + { +@@ -2133,10 +2354,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(); +-- +2.37.2 + diff --git a/applied/dwm-switchtotag-6.2.diff b/applied/dwm-switchtotag-6.2.diff deleted file mode 100644 index 453f8ef..0000000 --- a/applied/dwm-switchtotag-6.2.diff +++ /dev/null @@ -1,58 +0,0 @@ -diff -up dwm-6.2-original/config.def.h dwm-6.2-modified/config.def.h ---- dwm-6.2-original/config.def.h 2019-02-02 14:55:28.000000000 +0200 -+++ dwm-6.2-modified/config.def.h 2019-11-18 19:36:22.515566509 +0200 -@@ -26,9 +26,9 @@ 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 switchtotag isfloating monitor */ -+ { "Gimp", NULL, NULL, 0, 0, 1, -1 }, -+ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 }, - }; - - /* layout(s) */ -diff -up dwm-6.2-original/dwm.c dwm-6.2-modified/dwm.c ---- dwm-6.2-original/dwm.c 2019-02-02 14:55:28.000000000 +0200 -+++ dwm-6.2-modified/dwm.c 2019-11-18 19:37:18.792187705 +0200 -@@ -92,6 +92,7 @@ struct Client { - int basew, baseh, incw, inch, maxw, maxh, minw, minh; - int bw, oldbw; - unsigned int tags; -+ unsigned int switchtotag; - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; - Client *next; - Client *snext; -@@ -137,6 +138,7 @@ typedef struct { - const char *instance; - const char *title; - unsigned int tags; -+ unsigned int switchtotag; - int isfloating; - int monitor; - } Rule; -@@ -302,6 +304,11 @@ applyrules(Client *c) - for (m = mons; m && m->num != r->monitor; m = m->next); - if (m) - c->mon = m; -+ if (r->switchtotag) { -+ Arg a = { .ui = r->tags }; -+ c->switchtotag = selmon->tagset[selmon->seltags]; -+ view(&a); -+ } - } - } - if (ch.res_class) -@@ -1782,6 +1789,10 @@ unmanage(Client *c, int destroyed) - focus(NULL); - updateclientlist(); - arrange(m); -+ if (c->switchtotag) { -+ Arg a = { .ui = c->switchtotag }; -+ view(&a); -+ } - } - - void diff --git a/applied/dwm-systray-6.4.diff b/applied/dwm-systray-20230922-9f88553.diff index 58e4a69..9356ec1 100644 --- a/applied/dwm-systray-6.4.diff +++ b/applied/dwm-systray-20230922-9f88553.diff @@ -1,5 +1,5 @@ diff --git a/config.def.h b/config.def.h -index 9efa774..750529d 100644 +index 9efa774..fed4fb9 100644 --- a/config.def.h +++ b/config.def.h @@ -3,6 +3,11 @@ @@ -14,19 +14,8 @@ index 9efa774..750529d 100644 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" }; -@@ -101,8 +106,8 @@ static const Key keys[] = { - /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ - static const Button buttons[] = { - /* click event mask button function argument */ -- { ClkLtSymbol, 0, Button1, setlayout, {0} }, -- { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, -+ { ClkTagBar, MODKEY, Button1, tag, {0} }, -+ { ClkTagBar, MODKEY, Button3, toggletag, {0} }, - { ClkWinTitle, 0, Button2, zoom, {0} }, - { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, - { ClkClientWin, MODKEY, Button1, movemouse, {0} }, diff --git a/dwm.c b/dwm.c -index 03baf42..4611a03 100644 +index f1d86b2..f9e7e4a 100644 --- a/dwm.c +++ b/dwm.c @@ -57,12 +57,27 @@ @@ -96,15 +85,15 @@ index 03baf42..4611a03 100644 static void sendmon(Client *c, Monitor *m); static void setclientstate(Client *c, long state); static void setfocus(Client *c); -@@ -207,6 +232,7 @@ static void seturgent(Client *c, int urg); +@@ -206,6 +231,7 @@ static void setup(void); + static void seturgent(Client *c, int urg); static void showhide(Client *c); - static void sigchld(int unused); static void spawn(const Arg *arg); +static Monitor *systraytomon(Monitor *m); static void tag(const Arg *arg); static void tagmon(const Arg *arg); static void tile(Monitor *m); -@@ -224,18 +250,23 @@ static int updategeom(void); +@@ -223,18 +249,23 @@ static int updategeom(void); static void updatenumlockmask(void); static void updatesizehints(Client *c); static void updatestatus(void); @@ -128,7 +117,7 @@ index 03baf42..4611a03 100644 static const char broken[] = "broken"; static char stext[256]; static int screen; -@@ -258,9 +289,10 @@ static void (*handler[LASTEvent]) (XEvent *) = { +@@ -257,9 +288,10 @@ static void (*handler[LASTEvent]) (XEvent *) = { [MapRequest] = maprequest, [MotionNotify] = motionnotify, [PropertyNotify] = propertynotify, @@ -140,7 +129,7 @@ index 03baf42..4611a03 100644 static int running = 1; static Cur *cursor[CurLast]; static Clr **scheme; -@@ -442,7 +474,7 @@ buttonpress(XEvent *e) +@@ -441,7 +473,7 @@ buttonpress(XEvent *e) arg.ui = 1 << i; } else if (ev->x < x + TEXTW(selmon->ltsymbol)) click = ClkLtSymbol; @@ -149,7 +138,7 @@ index 03baf42..4611a03 100644 click = ClkStatusText; else click = ClkWinTitle; -@@ -485,6 +517,13 @@ cleanup(void) +@@ -484,6 +516,13 @@ cleanup(void) XUngrabKey(dpy, AnyKey, AnyModifier, root); while (mons) cleanupmon(mons); @@ -163,7 +152,7 @@ index 03baf42..4611a03 100644 for (i = 0; i < CurLast; i++) drw_cur_free(drw, cursor[i]); for (i = 0; i < LENGTH(colors); i++) -@@ -516,9 +555,58 @@ cleanupmon(Monitor *mon) +@@ -515,9 +554,58 @@ cleanupmon(Monitor *mon) void clientmessage(XEvent *e) { @@ -222,7 +211,7 @@ index 03baf42..4611a03 100644 if (!c) return; if (cme->message_type == netatom[NetWMState]) { -@@ -571,7 +659,7 @@ configurenotify(XEvent *e) +@@ -570,7 +658,7 @@ configurenotify(XEvent *e) for (c = m->clients; c; c = c->next) if (c->isfullscreen) resizeclient(c, m->mx, m->my, m->mw, m->mh); @@ -231,7 +220,7 @@ index 03baf42..4611a03 100644 } focus(NULL); arrange(NULL); -@@ -656,6 +744,11 @@ destroynotify(XEvent *e) +@@ -655,6 +743,11 @@ destroynotify(XEvent *e) if ((c = wintoclient(ev->window))) unmanage(c, 1); @@ -243,7 +232,7 @@ index 03baf42..4611a03 100644 } void -@@ -699,7 +792,7 @@ dirtomon(int dir) +@@ -698,7 +791,7 @@ dirtomon(int dir) void drawbar(Monitor *m) { @@ -252,7 +241,7 @@ index 03baf42..4611a03 100644 int boxs = drw->fonts->h / 9; int boxw = drw->fonts->h / 6 + 2; unsigned int i, occ = 0, urg = 0; -@@ -708,13 +801,17 @@ drawbar(Monitor *m) +@@ -707,13 +800,17 @@ drawbar(Monitor *m) if (!m->showbar) return; @@ -272,7 +261,7 @@ index 03baf42..4611a03 100644 for (c = m->clients; c; c = c->next) { occ |= c->tags; if (c->isurgent) -@@ -735,7 +832,7 @@ drawbar(Monitor *m) +@@ -734,7 +831,7 @@ drawbar(Monitor *m) drw_setscheme(drw, scheme[SchemeNorm]); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); @@ -281,7 +270,7 @@ index 03baf42..4611a03 100644 if (m->sel) { drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); -@@ -746,7 +843,7 @@ drawbar(Monitor *m) +@@ -745,7 +842,7 @@ drawbar(Monitor *m) drw_rect(drw, x, 0, w, bh, 1, 1); } } @@ -290,7 +279,7 @@ index 03baf42..4611a03 100644 } void -@@ -783,8 +880,11 @@ expose(XEvent *e) +@@ -782,8 +879,11 @@ expose(XEvent *e) Monitor *m; XExposeEvent *ev = &e->xexpose; @@ -303,7 +292,7 @@ index 03baf42..4611a03 100644 } void -@@ -870,14 +970,32 @@ getatomprop(Client *c, Atom prop) +@@ -869,14 +969,32 @@ getatomprop(Client *c, Atom prop) unsigned char *p = NULL; Atom da, atom = None; @@ -337,7 +326,7 @@ index 03baf42..4611a03 100644 int getrootptr(int *x, int *y) { -@@ -1018,7 +1136,8 @@ killclient(const Arg *arg) +@@ -1017,7 +1135,8 @@ killclient(const Arg *arg) { if (!selmon->sel) return; @@ -347,7 +336,7 @@ index 03baf42..4611a03 100644 XGrabServer(dpy); XSetErrorHandler(xerrordummy); XSetCloseDownMode(dpy, DestroyAll); -@@ -1105,6 +1224,13 @@ maprequest(XEvent *e) +@@ -1104,6 +1223,13 @@ maprequest(XEvent *e) static XWindowAttributes wa; XMapRequestEvent *ev = &e->xmaprequest; @@ -361,7 +350,7 @@ index 03baf42..4611a03 100644 if (!XGetWindowAttributes(dpy, ev->window, &wa) || wa.override_redirect) return; if (!wintoclient(ev->window)) -@@ -1226,6 +1352,17 @@ propertynotify(XEvent *e) +@@ -1225,6 +1351,17 @@ propertynotify(XEvent *e) Window trans; XPropertyEvent *ev = &e->xproperty; @@ -379,7 +368,7 @@ index 03baf42..4611a03 100644 if ((ev->window == root) && (ev->atom == XA_WM_NAME)) updatestatus(); else if (ev->state == PropertyDelete) -@@ -1276,6 +1413,19 @@ recttomon(int x, int y, int w, int h) +@@ -1275,6 +1412,19 @@ recttomon(int x, int y, int w, int h) return r; } @@ -399,7 +388,7 @@ index 03baf42..4611a03 100644 void resize(Client *c, int x, int y, int w, int h, int interact) { -@@ -1283,6 +1433,14 @@ resize(Client *c, int x, int y, int w, int h, int interact) +@@ -1282,6 +1432,14 @@ resize(Client *c, int x, int y, int w, int h, int interact) resizeclient(c, x, y, w, h); } @@ -414,7 +403,7 @@ index 03baf42..4611a03 100644 void resizeclient(Client *c, int x, int y, int w, int h) { -@@ -1298,6 +1456,19 @@ resizeclient(Client *c, int x, int y, int w, int h) +@@ -1297,6 +1455,19 @@ resizeclient(Client *c, int x, int y, int w, int h) XSync(dpy, False); } @@ -434,7 +423,7 @@ index 03baf42..4611a03 100644 void resizemouse(const Arg *arg) { -@@ -1444,26 +1615,37 @@ setclientstate(Client *c, long state) +@@ -1443,26 +1614,37 @@ setclientstate(Client *c, long state) } int @@ -483,7 +472,7 @@ index 03baf42..4611a03 100644 } return exists; } -@@ -1477,7 +1659,7 @@ setfocus(Client *c) +@@ -1476,7 +1658,7 @@ setfocus(Client *c) XA_WINDOW, 32, PropModeReplace, (unsigned char *) &(c->win), 1); } @@ -492,7 +481,7 @@ index 03baf42..4611a03 100644 } void -@@ -1566,6 +1748,10 @@ setup(void) +@@ -1572,6 +1754,10 @@ setup(void) wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False); netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False); netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); @@ -503,7 +492,7 @@ index 03baf42..4611a03 100644 netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False); -@@ -1573,6 +1759,9 @@ setup(void) +@@ -1579,6 +1765,9 @@ setup(void) netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); @@ -513,7 +502,7 @@ index 03baf42..4611a03 100644 /* init cursors */ cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); cursor[CurResize] = drw_cur_create(drw, XC_sizing); -@@ -1581,6 +1770,8 @@ setup(void) +@@ -1587,6 +1776,8 @@ setup(void) scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); for (i = 0; i < LENGTH(colors); i++) scheme[i] = drw_scm_create(drw, colors[i], 3); @@ -522,7 +511,7 @@ index 03baf42..4611a03 100644 /* init bars */ updatebars(); updatestatus(); -@@ -1711,7 +1902,18 @@ togglebar(const Arg *arg) +@@ -1717,7 +1908,18 @@ togglebar(const Arg *arg) { selmon->showbar = !selmon->showbar; updatebarpos(selmon); @@ -542,7 +531,7 @@ index 03baf42..4611a03 100644 arrange(selmon); } -@@ -1807,11 +2009,18 @@ unmapnotify(XEvent *e) +@@ -1813,11 +2015,18 @@ unmapnotify(XEvent *e) else unmanage(c, 0); } @@ -561,7 +550,7 @@ index 03baf42..4611a03 100644 Monitor *m; XSetWindowAttributes wa = { .override_redirect = True, -@@ -1822,10 +2031,15 @@ updatebars(void) +@@ -1828,10 +2037,15 @@ updatebars(void) for (m = mons; m; m = m->next) { if (m->barwin) continue; @@ -578,7 +567,7 @@ index 03baf42..4611a03 100644 XMapRaised(dpy, m->barwin); XSetClassHint(dpy, m->barwin, &ch); } -@@ -2002,6 +2216,125 @@ updatestatus(void) +@@ -2008,6 +2222,125 @@ updatestatus(void) if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) strcpy(stext, "dwm-"VERSION); drawbar(selmon); @@ -704,7 +693,7 @@ index 03baf42..4611a03 100644 } void -@@ -2069,6 +2402,16 @@ wintoclient(Window w) +@@ -2075,6 +2408,16 @@ wintoclient(Window w) return NULL; } @@ -721,7 +710,7 @@ index 03baf42..4611a03 100644 Monitor * wintomon(Window w) { -@@ -2122,6 +2465,22 @@ xerrorstart(Display *dpy, XErrorEvent *ee) +@@ -2128,6 +2471,22 @@ xerrorstart(Display *dpy, XErrorEvent *ee) return -1; } |