diff options
| author | Fuwn <[email protected]> | 2024-05-23 15:56:20 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-05-23 15:56:20 -0700 |
| commit | f1d4f7ac8bd36f5e771dc6a85ee46141344cecc0 (patch) | |
| tree | 58a0f8c90e2599100016660b5499786949d0e7aa | |
| parent | fix(dwm.c): correct systray position on bar toggle (diff) | |
| download | seiwm-f1d4f7ac8bd36f5e771dc6a85ee46141344cecc0.tar.xz seiwm-f1d4f7ac8bd36f5e771dc6a85ee46141344cecc0.zip | |
feat(dwm.c): dd attachaside patch
| -rw-r--r-- | dwm.c | 32 |
1 files changed, 28 insertions, 4 deletions
@@ -57,7 +57,8 @@ #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) #define ISINC(X) ((X) > 1000 && (X) < 3000) -#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]) || C->issticky) +#define ISVISIBLEONTAG(C, T) ((C->tags & T)) +#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags]) #define PREVSEL 3000 #define LENGTH(X) (sizeof X / sizeof X[0]) #define MOUSEMASK (BUTTONMASK|PointerMotionMask) @@ -224,6 +225,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 attachaside(Client *c); static void attachstack(Client *c); static void buttonpress(XEvent *e); static void checkotherwm(void); @@ -263,6 +265,7 @@ static void maprequest(XEvent *e); static void monocle(Monitor *m); static void motionnotify(XEvent *e); static void movemouse(const Arg *arg); +static Client *nexttagged(Client *c); static Client *nexttiled(Client *c); static void pop(Client *c); static void propertynotify(XEvent *e); @@ -539,6 +542,17 @@ attach(Client *c) } void +attachaside(Client *c) { + Client *at = nexttagged(c); + if(!at) { + attach(c); + return; + } + c->next = at->next; + at->next = c; +} + +void attachstack(Client *c) { c->snext = c->mon->stack; @@ -1421,7 +1435,7 @@ manage(Window w, XWindowAttributes *wa) c->isfloating = c->oldstate = trans != None || c->isfixed; if (c->isfloating) XRaiseWindow(dpy, c->win); - attach(c); + attachaside(c); attachstack(c); XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, (unsigned char *) &(c->win), 1); @@ -1574,6 +1588,16 @@ movemouse(const Arg *arg) } Client * +nexttagged(Client *c) { + Client *walked = c->mon->clients; + for(; + walked && (walked->isfloating || !ISVISIBLEONTAG(walked, c->tags)); + walked = walked->next + ); + return walked; +} + +Client * nexttiled(Client *c) { for (; c && (c->isfloating || !ISVISIBLE(c)); c = c->next); @@ -1872,7 +1896,7 @@ sendmon(Client *c, Monitor *m) detachstack(c); c->mon = m; c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ - attach(c); + attachaside(c); attachstack(c); setclienttagprop(c); focus(NULL); @@ -2515,7 +2539,7 @@ updategeom(void) m->clients = c->next; detachstack(c); c->mon = mons; - attach(c); + attachaside(c); attachstack(c); } if (m == selmon) |