From 9d82e395809521c4491009b13c1640173336c2ca Mon Sep 17 00:00:00 2001 From: bakkeby Date: Fri, 13 Sep 2019 00:06:54 +0200 Subject: [PATCH] Adding activetagindicatorbar, alwaysfullscreen and autoresize patches --- README.md | 11 +++++++++++ dwm.c | 33 +++++++++++++++++++++++++++++++++ patches.h | 28 +++++++++++++++++++++++++++- 3 files changed, 71 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e37f156..3bd1792 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: +2019-09-12 - Added activetagindicatorbar, alwaysfullscreen and autoresize patches + 2019-09-11 - Added monitor rules, combo and ewmhtags patches 2019-09-10 - Minor tweaks to awesomebar patch (incl. alpha and systray compatibility). Added floatbordercolor patch. @@ -29,12 +31,18 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Patches included: + - [activetagindicatorbar](https://dwm.suckless.org/patches/activetagindicatorbar/) + - this patch changes the rectangle indicating if a tag is used by a client into a bar above the tag name + - [alpha](https://dwm.suckless.org/patches/alpha/) - adds transparency for the status bar - [alternativetags](https://dwm.suckless.org/patches/alternativetags/) - adds alternative tags which can be toggled on the fly for the sole purpose of providing visual aid + - [alwaysfullscreen](https://dwm.suckless.org/patches/alwaysfullscreen/) + - prevents the focus to drift from the active fullscreen client when using focusstack\(\) + - [attachabove](https://dwm.suckless.org/patches/attachabove/) - new windows are placed above selected client @@ -47,6 +55,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t - [attachbottom](https://dwm.suckless.org/patches/attachbottom/) - new windows are placed at the bottom of the stack + - [autoresize](https://dwm.suckless.org/patches/autoresize/) + - by default, windows that are not visible when requesting a resize/move will not get resized/moved, with this patch, however, they will + - [autostart](https://dwm.suckless.org/patches/autostart/) - makes dwm run `~/.dwm/autostart_blocking.sh` and `~/.dwm/autostart.sh &` on startup diff --git a/dwm.c b/dwm.c index 555b818..420c2a8 100644 --- a/dwm.c +++ b/dwm.c @@ -125,6 +125,9 @@ struct Client { int bw, oldbw; unsigned int tags; int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + #if AUTORESIZE_PATCH + int needresize; + #endif // AUTORESIZE_PATCH #if CENTER_PATCH int iscentered; #endif // CENTER_PATCH @@ -840,6 +843,10 @@ configurerequest(XEvent *e) configure(c); if (ISVISIBLE(c)) XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); + #if AUTORESIZE_PATCH + else + c->needresize = 1; + #endif // AUTORESIZE_PATCH } else configure(c); } else { @@ -1012,7 +1019,9 @@ drawbar(Monitor *m) #if SYSTRAY_PATCH int stw = 0; #endif // SYSTRAY_PATCH + #if !ACTIVETAGINDICATORBAR_PATCH int boxs = drw->fonts->h / 9; + #endif // ACTIVETAGINDICATORBAR_PATCH int boxw = drw->fonts->h / 6 + 2; unsigned int i, occ = 0, urg = 0; Client *c; @@ -1064,9 +1073,15 @@ drawbar(Monitor *m) drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); #endif // ALTERNATIVE_TAGS_PATCH if (occ & 1 << i) + #if ACTIVETAGINDICATORBAR_PATCH + drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw, + m == selmon && selmon->sel && selmon->sel->tags & 1 << i, + urg & 1 << i); + #else drw_rect(drw, x + boxs, boxs, boxw, boxw, m == selmon && selmon->sel && selmon->sel->tags & 1 << i, urg & 1 << i); + #endif // ACTIVETAGINDICATORBAR_PATCH x += w; } w = blw = TEXTW(m->ltsymbol); @@ -1135,7 +1150,12 @@ drawbar(Monitor *m) #else if (m->sel) { drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); + #if CENTEREDWINDOWNAME_PATCH + int mid = (m->ww - TEXTW(m->sel->name)) / 2 - x; + drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0); + #else drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); + #endif // CENTEREDWINDOWNAME_PATCH if (m->sel->isfloating) drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); } else { @@ -1286,6 +1306,10 @@ focusstack(const Arg *arg) if (!selmon->sel) return; + #if ALWAYSFULLSCREEN_PATCH + if (selmon->sel->isfullscreen) + return; + #endif // ALWAYSFULLSCREEN_PATCH if (arg->i > 0) { for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next); if (!c) @@ -2319,7 +2343,16 @@ showhide(Client *c) return; } #endif // SAVEFLOATS_PATCH + #if AUTORESIZE_PATCH + if (c->needresize) { + c->needresize = 0; + XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); + } else { + XMoveWindow(dpy, c->win, c->x, c->y); + } + #else XMoveWindow(dpy, c->win, c->x, c->y); + #endif // AUTORESIZE_PATCH if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen) resize(c, c->x, c->y, c->w, c->h, 0); showhide(c->snext); diff --git a/patches.h b/patches.h index adb1a1d..b4cc065 100644 --- a/patches.h +++ b/patches.h @@ -12,6 +12,12 @@ /* Patches */ +/* This patch changes the rectangle indicating if a tag is used by a client into a bar + * above the tag name for better visibility. + * https://dwm.suckless.org/patches/activetagindicatorbar/ + */ +#define ACTIVETAGINDICATORBAR_PATCH 0 + /* The alpha patch adds transparency for the status bar. * https://dwm.suckless.org/patches/alpha/ */ @@ -23,6 +29,12 @@ */ #define ALTERNATIVE_TAGS_PATCH 0 +/* This patch prevents the focus to drift from the active fullscreen client when + * using focusstack(). + * https://dwm.suckless.org/patches/alwaysfullscreen/ + */ +#define ALWAYSFULLSCREEN_PATCH 0 + /* This patch adds new clients above the selected client, instead of always * becoming the new master. This behaviour is known from Xmonad. * This patch takes precedence over ATTACHASIDE_PATCH. @@ -55,6 +67,12 @@ */ #define AUTOSTART_PATCH 0 +/* By default, windows that are not visible when requesting a resize/move will not + * get resized/moved. With this patch, they will. + * https://dwm.suckless.org/patches/autoresize/ + */ +#define AUTORESIZE_PATCH 0 + /* Enhanced taskbar that shows the titles of all visible windows in the status bar * and allows focus / hiding / unhiding of windows by clicking on the status bar. * Awesomebar takes precedence over fancybar. @@ -63,10 +81,17 @@ #define AWESOMEBAR_PATCH 0 /* This patch adds an iscentered rule to automatically center clients on the current monitor. + * This patch takes precedence over centeredwindowname and fancybar patches. * https://dwm.suckless.org/patches/center/ */ #define CENTER_PATCH 0 +/* This patch centers the WM_NAME of the currently selected window on the status bar. + * Both fancybar and awesomebar patches take precedence over this patch. + * https://dwm.suckless.org/patches/centeredwindowname/ + */ +#define CENTEREDWINDOWNAME_PATCH 0 + /* This patch provides the ability to assign different weights to clients in their * respective stack in tiled layout. * https://dwm.suckless.org/patches/cfacts/ @@ -94,7 +119,8 @@ /* This patch shows the titles of all visible windows in the status bar * (as opposed to showing only the selected one). - * Awesomebar takes precedence over fancybar. + * Awesomebar takes precedence over fancybar. Fancybar takes precedence over + * the centeredwindowname patch. * https://dwm.suckless.org/patches/fancybar/ */ #define FANCYBAR_PATCH 0