Adding activetagindicatorbar, alwaysfullscreen and autoresize patches

This commit is contained in:
bakkeby 2019-09-13 00:06:54 +02:00
parent 9e17c55d95
commit 9d82e39580
3 changed files with 71 additions and 1 deletions

View File

@ -13,6 +13,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog: ### Changelog:
2019-09-12 - Added activetagindicatorbar, alwaysfullscreen and autoresize patches
2019-09-11 - Added monitor rules, combo and ewmhtags 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. 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: ### 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/) - [alpha](https://dwm.suckless.org/patches/alpha/)
- adds transparency for the status bar - adds transparency for the status bar
- [alternativetags](https://dwm.suckless.org/patches/alternativetags/) - [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 - 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/) - [attachabove](https://dwm.suckless.org/patches/attachabove/)
- new windows are placed above selected client - 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/) - [attachbottom](https://dwm.suckless.org/patches/attachbottom/)
- new windows are placed at the bottom of the stack - 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/) - [autostart](https://dwm.suckless.org/patches/autostart/)
- makes dwm run `~/.dwm/autostart_blocking.sh` and `~/.dwm/autostart.sh &` on startup - makes dwm run `~/.dwm/autostart_blocking.sh` and `~/.dwm/autostart.sh &` on startup

33
dwm.c
View File

@ -125,6 +125,9 @@ struct Client {
int bw, oldbw; int bw, oldbw;
unsigned int tags; unsigned int tags;
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
#if AUTORESIZE_PATCH
int needresize;
#endif // AUTORESIZE_PATCH
#if CENTER_PATCH #if CENTER_PATCH
int iscentered; int iscentered;
#endif // CENTER_PATCH #endif // CENTER_PATCH
@ -840,6 +843,10 @@ configurerequest(XEvent *e)
configure(c); configure(c);
if (ISVISIBLE(c)) if (ISVISIBLE(c))
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
#if AUTORESIZE_PATCH
else
c->needresize = 1;
#endif // AUTORESIZE_PATCH
} else } else
configure(c); configure(c);
} else { } else {
@ -1012,7 +1019,9 @@ drawbar(Monitor *m)
#if SYSTRAY_PATCH #if SYSTRAY_PATCH
int stw = 0; int stw = 0;
#endif // SYSTRAY_PATCH #endif // SYSTRAY_PATCH
#if !ACTIVETAGINDICATORBAR_PATCH
int boxs = drw->fonts->h / 9; int boxs = drw->fonts->h / 9;
#endif // ACTIVETAGINDICATORBAR_PATCH
int boxw = drw->fonts->h / 6 + 2; int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0; unsigned int i, occ = 0, urg = 0;
Client *c; Client *c;
@ -1064,9 +1073,15 @@ drawbar(Monitor *m)
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
#endif // ALTERNATIVE_TAGS_PATCH #endif // ALTERNATIVE_TAGS_PATCH
if (occ & 1 << i) 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, drw_rect(drw, x + boxs, boxs, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->tags & 1 << i, m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
urg & 1 << i); urg & 1 << i);
#endif // ACTIVETAGINDICATORBAR_PATCH
x += w; x += w;
} }
w = blw = TEXTW(m->ltsymbol); w = blw = TEXTW(m->ltsymbol);
@ -1135,7 +1150,12 @@ drawbar(Monitor *m)
#else #else
if (m->sel) { if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); 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); drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
#endif // CENTEREDWINDOWNAME_PATCH
if (m->sel->isfloating) if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
} else { } else {
@ -1286,6 +1306,10 @@ focusstack(const Arg *arg)
if (!selmon->sel) if (!selmon->sel)
return; return;
#if ALWAYSFULLSCREEN_PATCH
if (selmon->sel->isfullscreen)
return;
#endif // ALWAYSFULLSCREEN_PATCH
if (arg->i > 0) { if (arg->i > 0) {
for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next); for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next);
if (!c) if (!c)
@ -2319,7 +2343,16 @@ showhide(Client *c)
return; return;
} }
#endif // SAVEFLOATS_PATCH #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); XMoveWindow(dpy, c->win, c->x, c->y);
#endif // AUTORESIZE_PATCH
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen) if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
resize(c, c->x, c->y, c->w, c->h, 0); resize(c, c->x, c->y, c->w, c->h, 0);
showhide(c->snext); showhide(c->snext);

View File

@ -12,6 +12,12 @@
/* Patches */ /* 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. /* The alpha patch adds transparency for the status bar.
* https://dwm.suckless.org/patches/alpha/ * https://dwm.suckless.org/patches/alpha/
*/ */
@ -23,6 +29,12 @@
*/ */
#define ALTERNATIVE_TAGS_PATCH 0 #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 /* This patch adds new clients above the selected client, instead of always
* becoming the new master. This behaviour is known from Xmonad. * becoming the new master. This behaviour is known from Xmonad.
* This patch takes precedence over ATTACHASIDE_PATCH. * This patch takes precedence over ATTACHASIDE_PATCH.
@ -55,6 +67,12 @@
*/ */
#define AUTOSTART_PATCH 0 #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 /* 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. * and allows focus / hiding / unhiding of windows by clicking on the status bar.
* Awesomebar takes precedence over fancybar. * Awesomebar takes precedence over fancybar.
@ -63,10 +81,17 @@
#define AWESOMEBAR_PATCH 0 #define AWESOMEBAR_PATCH 0
/* This patch adds an iscentered rule to automatically center clients on the current monitor. /* 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/ * https://dwm.suckless.org/patches/center/
*/ */
#define CENTER_PATCH 0 #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 /* This patch provides the ability to assign different weights to clients in their
* respective stack in tiled layout. * respective stack in tiled layout.
* https://dwm.suckless.org/patches/cfacts/ * https://dwm.suckless.org/patches/cfacts/
@ -94,7 +119,8 @@
/* This patch shows the titles of all visible windows in the status bar /* This patch shows the titles of all visible windows in the status bar
* (as opposed to showing only the selected one). * (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/ * https://dwm.suckless.org/patches/fancybar/
*/ */
#define FANCYBAR_PATCH 0 #define FANCYBAR_PATCH 0