attach bottom patch

This commit is contained in:
Jakub 2024-05-10 18:38:38 -04:00
parent 09825f889b
commit 7bc7cccda1
2 changed files with 67 additions and 3 deletions

16
dwm.c
View File

@ -152,6 +152,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac
static void arrange(Monitor *m); static void arrange(Monitor *m);
static void arrangemon(Monitor *m); static void arrangemon(Monitor *m);
static void attach(Client *c); static void attach(Client *c);
static void attachbottom(Client *c);
static void attachstack(Client *c); static void attachstack(Client *c);
static void buttonpress(XEvent *e); static void buttonpress(XEvent *e);
static void checkotherwm(void); static void checkotherwm(void);
@ -422,6 +423,15 @@ attach(Client *c)
c->mon->clients = c; c->mon->clients = c;
} }
void
attachbottom(Client *c)
{
Client **tc;
c->next = NULL;
for (tc = &c->mon->clients; *tc; tc = &(*tc)->next);
*tc = c;
}
void void
attachstack(Client *c) attachstack(Client *c)
{ {
@ -1103,7 +1113,7 @@ manage(Window w, XWindowAttributes *wa)
c->isfloating = c->oldstate = trans != None || c->isfixed; c->isfloating = c->oldstate = trans != None || c->isfixed;
if (c->isfloating) if (c->isfloating)
XRaiseWindow(dpy, c->win); XRaiseWindow(dpy, c->win);
attach(c); attachbottom(c);
attachstack(c); attachstack(c);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &(c->win), 1); (unsigned char *) &(c->win), 1);
@ -1456,7 +1466,7 @@ sendmon(Client *c, Monitor *m)
detachstack(c); detachstack(c);
c->mon = m; c->mon = m;
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
attach(c); attachbottom(c);
attachstack(c); attachstack(c);
focus(NULL); focus(NULL);
arrange(NULL); arrange(NULL);
@ -1970,7 +1980,7 @@ updategeom(void)
m->clients = c->next; m->clients = c->next;
detachstack(c); detachstack(c);
c->mon = mons; c->mon = mons;
attach(c); attachbottom(c);
attachstack(c); attachstack(c);
} }
if (m == selmon) if (m == selmon)

View File

@ -0,0 +1,54 @@
diff -up dwm-6.3/dwm.c dwm-6.3-attachbottom/dwm.c
--- dwm-6.3/dwm.c 2022-01-07 12:42:18.000000000 +0100
+++ dwm-6.3-attachbottom/dwm.c 2022-08-17 22:14:41.813809073 +0200
@@ -147,6 +147,7 @@ static int applysizehints(Client *c, int
static void arrange(Monitor *m);
static void arrangemon(Monitor *m);
static void attach(Client *c);
+static void attachbottom(Client *c);
static void attachstack(Client *c);
static void buttonpress(XEvent *e);
static void checkotherwm(void);
@@ -408,6 +409,15 @@ attach(Client *c)
}
void
+attachbottom(Client *c)
+{
+ Client **tc;
+ c->next = NULL;
+ for (tc = &c->mon->clients; *tc; tc = &(*tc)->next);
+ *tc = c;
+}
+
+void
attachstack(Client *c)
{
c->snext = c->mon->stack;
@@ -1066,7 +1076,7 @@ manage(Window w, XWindowAttributes *wa)
c->isfloating = c->oldstate = trans != None || c->isfixed;
if (c->isfloating)
XRaiseWindow(dpy, c->win);
- attach(c);
+ attachbottom(c);
attachstack(c);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &(c->win), 1);
@@ -1421,7 +1431,7 @@ sendmon(Client *c, Monitor *m)
detachstack(c);
c->mon = m;
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
- attach(c);
+ attachbottom(c);
attachstack(c);
focus(NULL);
arrange(NULL);
@@ -1903,7 +1913,7 @@ updategeom(void)
m->clients = c->next;
detachstack(c);
c->mon = mons;
- attach(c);
+ attachbottom(c);
attachstack(c);
}
if (m == selmon)