Skip to content

Commit

Permalink
Attach bottom patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaweees committed Mar 5, 2024
1 parent e613380 commit cf28f61
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .config/dwm/dwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,7 @@ static int applysizehints(
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);
Expand Down Expand Up @@ -1573,6 +1574,13 @@ void attach(Client *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;
}

/* This inserts a client at the top of the monitor's stacking order.
*
* The stacking order is a linked list of client structures where one client
Expand Down Expand Up @@ -3960,7 +3968,7 @@ void manage(Window w, XWindowAttributes *wa) {
if (c->isfloating) XRaiseWindow(dpy, c->win);
/* Add the client to the client list. New clients are always added at the top
* of the list making them the new master client. */
attach(c);
attachbottom(c);
/* Add the client to the stacking order list. New additions are always added
* at the top of the list to indicate order in which clients had focus. */
attachstack(c);
Expand Down Expand Up @@ -4386,7 +4394,7 @@ void pop(Client *c) {
* stack (list of clients) and adds it again at the start of the list making
* it the new master window. */
detach(c);
attach(c);
attachbottom(c);
focus(c); /* Make sure the given window has input focus */
arrange(c->mon); /* Rearrange all tiled windows as the order has changed */
}
Expand Down Expand Up @@ -5073,7 +5081,7 @@ void sendmon(Client *c, Monitor *m) {
* viewed tags on that monitor. */
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
/* Add the client to the target monitor's client list. */
attach(c);
attachbottom(c);
/* Add the client to the target monitor's stacking order list. */
attachstack(c);

Expand Down
54 changes: 54 additions & 0 deletions .config/dwm/patches/dwm-attachbottom-6.3.diff
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit cf28f61

Please sign in to comment.