diff options
| author | bakkeby <[email protected]> | 2020-09-10 15:24:51 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2020-09-10 15:24:51 +0200 |
| commit | d91db5cd653507f67f1c188ce8440783e88518a8 (patch) | |
| tree | ba8050502d38eecb94d12666bbdb766b39d6f5ba /patch | |
| parent | 8994f375e8ca8042996d752a385b8d1706526a25 (diff) | |
| download | dwm-flexipatch-d91db5cd653507f67f1c188ce8440783e88518a8.tar.gz dwm-flexipatch-d91db5cd653507f67f1c188ce8440783e88518a8.zip | |
anybar: adding experimental support for having both anybar + dwm bar(s) in play
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/bar_anybar.c | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/patch/bar_anybar.c b/patch/bar_anybar.c index cc4b714..05b2513 100644 --- a/patch/bar_anybar.c +++ b/patch/bar_anybar.c @@ -2,17 +2,32 @@ void managealtbar(Window win, XWindowAttributes *wa) { Monitor *m; + Bar *bar; + int i; if (!(m = recttomon(wa->x, wa->y, wa->width, wa->height))) return; - - m->bar->win = win; - m->bar->by = wa->y; - bh = m->bar->bh = wa->height; + for (i = 0, bar = m->bar; bar && bar->win && bar->next; bar = bar->next, ++i); // find last bar + if (!bar) { + bar = m->bar = ecalloc(1, sizeof(Bar)); + bar->topbar = topbar; + } else if (bar && bar->win) { + bar->next = ecalloc(1, sizeof(Bar)); + bar->next->topbar = !bar->topbar; + bar = bar->next; + } + bar->external = 1; + bar->showbar = 1; + bar->mon = m; + bar->idx = i; + bar->borderpx = 0; + bar->win = win; + bar->bh = wa->height; updatebarpos(m); arrange(m); XSelectInput(dpy, win, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); - XMoveResizeWindow(dpy, win, wa->x, wa->y, wa->width, wa->height); XMapWindow(dpy, win); + XMoveResizeWindow(dpy, bar->win, bar->bx, -bar->by, wa->width, bar->bh); + arrange(selmon); XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, (unsigned char *) &win, 1); } @@ -27,16 +42,21 @@ spawnbar() void unmanagealtbar(Window w) { - Monitor *m = wintomon(w); + Monitor *m = wintomon(w); + Bar *bar; - if (!m) - return; + if (!m) + return; - m->bar->win = 0; - m->bar->by = 0; - m->bar->bh = 0; - updatebarpos(m); - arrange(m); + for (bar = m->bar; bar && bar->win; bar = bar->next) + if (bar->win == w) { + bar->win = 0; + bar->by = 0; + bar->bh = 0; + break; + } + updatebarpos(m); + arrange(m); } int |
