commit c138ee8d99cdacd2963e8f00953a20b6e36cc8d5
parent 43791fd5edc5aa3bbb0928279af039962b0be9cd
Author: ssnf <ssnf@ssnf.xyz>
Date: Wed, 28 Sep 2022 13:26:04 +0000
don't draw status if it is empty
Diffstat:
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/config.h b/config.h
@@ -42,8 +42,8 @@ static const Rule rules[] = {
};
/* layout(s) */
-static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
-static const int nmaster = 2; /* number of clients in master area */
+static const float mfact = 0.6; /* factor of master area size [0.05..0.95] */
+static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
static const Layout layouts[] = {
@@ -81,6 +81,7 @@ static const char* mict[] = { "mict", NULL };
static const char* mont[] = { "mont", NULL };
static const char* news[] = { "st", "-e", "newsboat", NULL };
static const char* pass[] = { "passd", NULL };
+static const char* paste[] = { "paste", NULL };
static const char* spkrd[] = { "pamixer", "-d", "5", NULL };
static const char* spkri[] = { "pamixer", "-i", "5", NULL };
static const char* spkrt[] = { "pamixer", "-t", NULL };
@@ -101,6 +102,7 @@ static Key keys[] = {
{ 0, XF86XK_Sleep, spawn, {.v = lock} },
{ MOD, XK_n, spawn, {.v = news} },
{ MOD, XK_o, spawn, {.v = pass} },
+ { MOD|SHIFT, XK_p, spawn, {.v = paste} },
{ 0, XF86XK_AudioMute, spawn, {.v = spkrt} },
{ MOD, XK_KP_Multiply, spawn, {.v = spkrt} },
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = spkri} },
diff --git a/dwm.c b/dwm.c
@@ -839,24 +839,28 @@ Monitor* dirtomon(int dir)
void
drawbar(Monitor* m)
{
- int x, w, tw = 0;
- int boxs = drw->fonts->h / 9;
- int boxw = drw->fonts->h / 6 + 2;
- uint i, occ = 0, urg = 0;
+ int x, w, tw;
+ int boxs, boxw;
+ uint i, occ, urg;
Client* c;
+
/* draw status first so it can be overdrawn by tags later */
- if (m == selmon) { /* status is only drawn on selected monitor */
+ tw = 0;
+ if (m == selmon && *stext) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
drw_text(drw, m->ww - tw - 2 * sp, 0, tw, bh, 0, stext, 0);
}
+ occ = urg = 0;
for (c = m->clients; c; c = c->next) {
occ |= c->tags;
if (c->isurgent)
urg |= c->tags;
}
+ boxs = drw->fonts->h / 9;
+ boxw = drw->fonts->h / 6 + 2;
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
@@ -876,7 +880,6 @@ drawbar(Monitor* m)
x += w;
}
drw_setscheme(drw, scheme[SchemeNorm]);
-
if ((w = m->ww - tw - x) > bh) {
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
@@ -2313,7 +2316,7 @@ void
updatestatus()
{
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
- strcpy(stext, "dwm-6.2");
+ *stext = '\0';
drawbar(selmon);
}