diff options
| author | LM-LCL <hello@exaltedelite.club> | 2025-09-18 09:42:26 +0200 |
|---|---|---|
| committer | LM-LCL <hello@exaltedelite.club> | 2025-09-18 09:42:26 +0200 |
| commit | 9704c916faa249fd56859648f3fc59b08288b05b (patch) | |
| tree | 03dc896fa023a5c3e4bd5ad8f6cfe54f3bd1ca7c | |
| parent | afc865cfc48317ae94db0beee4925813de846906 (diff) | |
Patch changes
| -rw-r--r-- | config.def.h | 2 | ||||
| -rw-r--r-- | config.h | 2 | ||||
| -rw-r--r-- | dwm.1 | 3 | ||||
| -rw-r--r-- | dwm.c | 59 | ||||
| -rw-r--r-- | patches/dwm-attachbelow-6.2.diff | 96 | ||||
| -rw-r--r-- | patches/dwm-clientresizehints-6.5.diff | 76 |
6 files changed, 16 insertions, 222 deletions
diff --git a/config.def.h b/config.def.h index 1ec348d..1deb64b 100644 --- a/config.def.h +++ b/config.def.h @@ -21,7 +21,6 @@ static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_white, col_gray1, col_gray2 }, [SchemeSel] = { col_white, col_gray2, col_orange }, - [SchemeSelTab] = { col_orange, col_gray2 }, }; /* tab */ @@ -63,7 +62,6 @@ static const Rule rules[] = { static const float mfact = 0.5; /* factor of master area size [0.05..0.95] */ static const int nmaster = 1; /* number of clients in master area */ static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */ -static const int attachbelow = 1; /* 1 means attach after the currently active window */ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ static const Layout layouts[] = { @@ -21,7 +21,6 @@ static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_white, col_gray1, col_gray2 }, [SchemeSel] = { col_white, col_gray2, col_orange }, - [SchemeSelTab] = { col_orange, col_gray2 }, }; /* tab */ @@ -63,7 +62,6 @@ static const Rule rules[] = { static const float mfact = 0.5; /* factor of master area size [0.05..0.95] */ static const int nmaster = 1; /* number of clients in master area */ static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */ -static const int attachbelow = 1; /* 1 means attach after the currently active window */ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ static const Layout layouts[] = { @@ -37,9 +37,6 @@ display modes of this bar are described under the Mod1\-w Keybord command section. When a single tag is selected, this tag is indicated in the left corner of the tab bar. .P -The attach below patch makes newly spawned windows attach after the currently -selected window -.P dwm draws a small border around windows to indicate the focus state. .SH OPTIONS .TP @@ -71,7 +71,7 @@ /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ -enum { SchemeNorm, SchemeSel, SchemeSelTab }; /* color schemes */ +enum { SchemeNorm, SchemeSel }; /* color schemes */ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz, NetWMFullscreen, NetActiveWindow, NetWMWindowType, @@ -106,7 +106,7 @@ 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, resizehints; + int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; Client *next; Client *snext; Monitor *mon; @@ -161,7 +161,6 @@ typedef struct { unsigned int tags; int isfloating; int monitor; - int resizehints; } Rule; typedef struct Systray Systray; @@ -176,7 +175,6 @@ 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); -static void attachBelow(Client *c); static void attachstack(Client *c); static void buttonpress(XEvent *e); static void checkotherwm(void); @@ -343,7 +341,6 @@ applyrules(Client *c) { c->isfloating = r->isfloating; c->tags |= r->tags; - c->resizehints = r->resizehints; for (m = mons; m && m->num != r->monitor; m = m->next); if (m) c->mon = m; @@ -388,7 +385,7 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact) *h = bh; if (*w < bh) *w = bh; - if (c->resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) { + if (resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) { if (!c->hintsvalid) updatesizehints(c); /* see last two sentences in ICCCM 4.1.2.3 */ @@ -453,21 +450,6 @@ attach(Client *c) c->next = c->mon->clients; c->mon->clients = c; } -void -attachBelow(Client *c) -{ - //If there is nothing on the monitor or the selected client is floating, attach as normal - if(c->mon->sel == NULL || c->mon->sel == c || c->mon->sel->isfloating) { - attach(c); - return; - } - - //Set the new client's next property to the same as the currently selected clients next - c->next = c->mon->sel->next; - //Set the currently selected clients next property to the new client - c->mon->sel->next = c; - -} void attachstack(Client *c) @@ -523,7 +505,8 @@ buttonpress(XEvent *e) click = ClkTabBar; arg.ui = i; } - } else if ((c = wintoclient(ev->window))) { + } + else if((c = wintoclient(ev->window))) { if (focusonwheel || (ev->button != Button4 && ev->button != Button5)) focus(c); XAllowEvents(dpy, ReplayPointer, CurrentTime); @@ -942,7 +925,7 @@ drawtab(Monitor *m) { /* add the remainder to the last tab so there is no leftover space left*/ if(remainder && i == m->ntabs - 1) m->tab_widths[i] += remainder; w = m->tab_widths[i]; - drw_setscheme(drw, scheme[(c == m->sel) ? SchemeSelTab : SchemeNorm]); + drw_setscheme(drw, scheme[(c == m->sel) ? SchemeSel : SchemeNorm]); tm = (m->tab_widths[i] - (int)TEXTW(c->name)) / 2; tm = (int)TEXTW(c->name) >= m->tab_widths[i] ? lrpad / 2 : tm; drw_text(drw, x, 0, w, th, tm, c->name, 0); @@ -1036,16 +1019,16 @@ focusstack(const Arg *arg) return; if (arg->i > 0) { for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next); - /* if (!c) */ - /* for (c = selmon->clients; c && !ISVISIBLE(c); c = c->next); */ + if (!c) + for (c = selmon->clients; c && !ISVISIBLE(c); c = c->next); } else { for (i = selmon->clients; i != selmon->sel; i = i->next) if (ISVISIBLE(i)) c = i; - /* if (!c) */ - /* for (; i; i = i->next) */ - /* if (ISVISIBLE(i)) */ - /* c = i; */ + if (!c) + for (; i; i = i->next) + if (ISVISIBLE(i)) + c = i; } if (c) { focus(c); @@ -1267,7 +1250,6 @@ manage(Window w, XWindowAttributes *wa) c->w = c->oldw = wa->width; c->h = c->oldh = wa->height; c->oldbw = wa->border_width; - c->resizehints = resizehints; updatetitle(c); if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { @@ -1301,10 +1283,7 @@ manage(Window w, XWindowAttributes *wa) c->isfloating = c->oldstate = trans != None || c->isfixed; if (c->isfloating) XRaiseWindow(dpy, c->win); - if( attachbelow ) - attachBelow(c); - else - attach(c); + attach(c); attachstack(c); XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, (unsigned char *) &(c->win), 1); @@ -1315,7 +1294,7 @@ manage(Window w, XWindowAttributes *wa) c->mon->sel = c; arrange(c->mon); XMapWindow(dpy, c->win); - focus(NULL); + focus(NULL); } void @@ -1695,10 +1674,7 @@ sendmon(Client *c, Monitor *m) detachstack(c); c->mon = m; c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ - if( attachbelow ) - attachBelow(c); - else - attach(c); + attach(c); attachstack(c); focus(NULL); arrange(NULL); @@ -2287,10 +2263,7 @@ updategeom(void) m->clients = c->next; detachstack(c); c->mon = mons; - if( attachbelow ) - attachBelow(c); - else - attach(c); + attach(c); attachstack(c); } if (m == selmon) diff --git a/patches/dwm-attachbelow-6.2.diff b/patches/dwm-attachbelow-6.2.diff deleted file mode 100644 index 1562b38..0000000 --- a/patches/dwm-attachbelow-6.2.diff +++ /dev/null @@ -1,96 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 1c0b587..cb8053a 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -35,6 +35,7 @@ static const Rule rules[] = { - static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ - 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 attachbelow = 1; /* 1 means attach after the currently active window */ - - static const Layout layouts[] = { - /* symbol arrange function */ -diff --git a/dwm.1 b/dwm.1 -index 13b3729..fb6e76c 100644 ---- a/dwm.1 -+++ b/dwm.1 -@@ -29,6 +29,9 @@ color. The tags of the focused window are indicated with a filled square in the - top left corner. The tags which are applied to one or more windows are - indicated with an empty square in the top left corner. - .P -+The attach below patch makes newly spawned windows attach after the currently -+selected window -+.P - dwm draws a small border around windows to indicate the focus state. - .SH OPTIONS - .TP -diff --git a/dwm.c b/dwm.c -index 4465af1..bd715a2 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -147,6 +147,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); -+static void attachBelow(Client *c); - static void attachstack(Client *c); - static void buttonpress(XEvent *e); - static void checkotherwm(void); -@@ -405,6 +406,21 @@ attach(Client *c) - c->next = c->mon->clients; - c->mon->clients = c; - } -+void -+attachBelow(Client *c) -+{ -+ //If there is nothing on the monitor or the selected client is floating, attach as normal -+ if(c->mon->sel == NULL || c->mon->sel == c || c->mon->sel->isfloating) { -+ attach(c); -+ return; -+ } -+ -+ //Set the new client's next property to the same as the currently selected clients next -+ c->next = c->mon->sel->next; -+ //Set the currently selected clients next property to the new client -+ c->mon->sel->next = c; -+ -+} - - void - attachstack(Client *c) -@@ -1062,7 +1078,10 @@ manage(Window w, XWindowAttributes *wa) - c->isfloating = c->oldstate = trans != None || c->isfixed; - if (c->isfloating) - XRaiseWindow(dpy, c->win); -- attach(c); -+ if( attachbelow ) -+ attachBelow(c); -+ else -+ attach(c); - attachstack(c); - XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, - (unsigned char *) &(c->win), 1); -@@ -1417,7 +1436,10 @@ sendmon(Client *c, Monitor *m) - detachstack(c); - c->mon = m; - c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ -- attach(c); -+ if( attachbelow ) -+ attachBelow(c); -+ else -+ attach(c); - attachstack(c); - focus(NULL); - arrange(NULL); -@@ -1897,7 +1919,10 @@ updategeom(void) - m->clients = c->next; - detachstack(c); - c->mon = mons; -- attach(c); -+ if( attachbelow ) -+ attachBelow(c); -+ else -+ attach(c); - attachstack(c); - } - if (m == selmon) diff --git a/patches/dwm-clientresizehints-6.5.diff b/patches/dwm-clientresizehints-6.5.diff deleted file mode 100644 index b05c84d..0000000 --- a/patches/dwm-clientresizehints-6.5.diff +++ /dev/null @@ -1,76 +0,0 @@ -From b2de13e11e7b4d67b4982ef51befa87ed9202080 Mon Sep 17 00:00:00 2001 -From: Fred Frey <fred@fpf3.net> -Date: Sun, 22 Sep 2024 16:09:53 -0400 -Subject: [PATCH] implement per-client resizehints - ---- - config.def.h | 6 +++--- - dwm.c | 7 +++++-- - 2 files changed, 8 insertions(+), 5 deletions(-) - -diff --git a/config.def.h b/config.def.h -index 9efa774..67e7a9c 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -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 isfloating monitor resizehints */ -+ { "Gimp", NULL, NULL, 0, 1, -1, 1}, -+ { "Firefox", NULL, NULL, 1 << 8, 0, -1, 1}, - }; - - /* layout(s) */ -diff --git a/dwm.c b/dwm.c -index 67c6b2b..f179b4c 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -92,7 +92,7 @@ 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, resizehints; - Client *next; - Client *snext; - Monitor *mon; -@@ -139,6 +139,7 @@ typedef struct { - unsigned int tags; - int isfloating; - int monitor; -+ int resizehints; - } Rule; - - /* function declarations */ -@@ -299,6 +300,7 @@ applyrules(Client *c) - { - c->isfloating = r->isfloating; - c->tags |= r->tags; -+ c->resizehints = r->resizehints; - for (m = mons; m && m->num != r->monitor; m = m->next); - if (m) - c->mon = m; -@@ -343,7 +345,7 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact) - *h = bh; - if (*w < bh) - *w = bh; -- if (resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) { -+ if (c->resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) { - if (!c->hintsvalid) - updatesizehints(c); - /* see last two sentences in ICCCM 4.1.2.3 */ -@@ -1043,6 +1045,7 @@ manage(Window w, XWindowAttributes *wa) - c->w = c->oldw = wa->width; - c->h = c->oldh = wa->height; - c->oldbw = wa->border_width; -+ c->resizehints = resizehints; - - updatetitle(c); - if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { --- -2.46.0 - |
