summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Rumbaugh <doug@douglasrumbaugh.com>2021-12-19 22:13:32 -0500
committerDouglas Rumbaugh <doug@douglasrumbaugh.com>2021-12-19 22:13:32 -0500
commit60036de81ef8279033682c6fc117627e96d7b574 (patch)
treea274332f5457a654e2e991b2bd51ec0e84e8a963
parenta92bca0d79269f7597720014973fd570b1253b91 (diff)
downloaddwm-60036de81ef8279033682c6fc117627e96d7b574.tar.gz
Applied statusbar font patch
https://dwm.suckless.org/patches/statusbarfont/
-rw-r--r--config.def.h10
-rw-r--r--drw.c8
-rw-r--r--drw.h4
-rw-r--r--dwm.110
-rw-r--r--dwm.c20
5 files changed, 34 insertions, 18 deletions
diff --git a/config.def.h b/config.def.h
index 9598465..1967e52 100644
--- a/config.def.h
+++ b/config.def.h
@@ -13,9 +13,13 @@ static unsigned int borderpx = 2; /* border pixel of windows */
static unsigned int snap = 32; /* snap pixel */
static int showbar = 1; /* 0 means no bar */
static int topbar = 1; /* 0 means bottom bar */
-static char font[] = "monospace:size=10";
-static char dmenufont[] = "monospace:size=10";
-static const char *fonts[] = { font };
+static char font[] = "monospace:size=16";
+static char dmenufont[] = "monospace:size=16";
+static char statusfont[] = "FiraCode Nerd Font:style=medium:antialias=true:pixelsize=18";
+
+static const char *fonts[] = { font, statusfont };
+static const int statusfontindex = 1;
+
static char normbgcolor[] = "#222222";
static char normbordercolor[] = "#444444";
static char normfgcolor[] = "#bbbbbb";
diff --git a/drw.c b/drw.c
index 8f1059e..073502e 100644
--- a/drw.c
+++ b/drw.c
@@ -249,7 +249,7 @@ drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int
}
int
-drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
+drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, const int fontindex)
{
char buf[1024];
int ty;
@@ -288,6 +288,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
nextfont = NULL;
while (*text) {
utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ);
+ curfont = drw->fonts;
+ for (int i=0;i<fontindex;i++){ curfont = curfont->next ;}
for (curfont = drw->fonts; curfont; curfont = curfont->next) {
charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
if (charexists) {
@@ -390,11 +392,11 @@ drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
}
unsigned int
-drw_fontset_getwidth(Drw *drw, const char *text)
+drw_fontset_getwidth(Drw *drw, const char *text ,int fontindex)
{
if (!drw || !drw->fonts || !text)
return 0;
- return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
+ return drw_text(drw, 0, 0, 0, 0, 0, text, 0,fontindex);
}
void
diff --git a/drw.h b/drw.h
index 42b04ce..2fc0520 100644
--- a/drw.h
+++ b/drw.h
@@ -34,7 +34,7 @@ void drw_free(Drw *drw);
/* Fnt abstraction */
Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
void drw_fontset_free(Fnt* set);
-unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
+unsigned int drw_fontset_getwidth(Drw *drw, const char *text, int fontindex);
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
/* Colorscheme abstraction */
@@ -51,7 +51,7 @@ void drw_setscheme(Drw *drw, Clr *scm);
/* Drawing functions */
void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
-int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert);
+int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, const int fontindex);
/* Map functions */
void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
diff --git a/dwm.1 b/dwm.1
index ddc8321..7b6cadb 100644
--- a/dwm.1
+++ b/dwm.1
@@ -142,6 +142,9 @@ Add/remove all windows with nth tag to/from the view.
.TP
.B Mod1\-Shift\-q
Quit dwm.
+.TP
+.B Mod1\-Control\-Shift\-q
+Restart dwm.
.SS Mouse commands
.TP
.B Mod1\-Button1
@@ -155,6 +158,13 @@ Resize focused window while dragging. Tiled windows will be toggled to the float
.SH CUSTOMIZATION
dwm is customized by creating a custom config.h and (re)compiling the source
code. This keeps it fast, secure and simple.
+.SH SIGNALS
+.TP
+.B SIGHUP - 1
+Restart the dwm process.
+.TP
+.B SIGTERM - 15
+Cleanly terminate the dwm process.
.SH SEE ALSO
.BR dmenu (1),
.BR st (1)
diff --git a/dwm.c b/dwm.c
index 015f469..8ff8be3 100644
--- a/dwm.c
+++ b/dwm.c
@@ -65,7 +65,7 @@
#define TAGMASK ((1 << NUMTAGS) - 1)
#define SPTAG(i) ((1 << LENGTH(tags)) << (i))
#define SPTAGMASK (((1 << LENGTH(scratchpads))-1) << LENGTH(tags))
-#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
+#define TEXTW(X,F) (drw_fontset_getwidth(drw, (X),(F)) + lrpad)
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
@@ -531,14 +531,14 @@ buttonpress(XEvent *e)
if (ev->window == selmon->barwin) {
i = x = 0;
do
- x += TEXTW(tags[i]);
+ x += TEXTW(tags[i], 0);
while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
} else if (ev->x < x + blw)
click = ClkLtSymbol;
- else if (ev->x > selmon->ww - (int)TEXTW(stext))
+ else if (ev->x > selmon->ww - (int)TEXTW(stext, statusfontindex))
click = ClkStatusText;
else
click = ClkWinTitle;
@@ -813,8 +813,8 @@ drawbar(Monitor *m)
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* 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, 0, tw, bh, 0, stext, 0);
+ tw = TEXTW(stext, statusfontindex) - lrpad + 2; /* 2px right padding */
+ drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0, statusfontindex);
}
for (c = m->clients; c; c = c->next) {
@@ -824,23 +824,23 @@ drawbar(Monitor *m)
}
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
- w = TEXTW(tags[i]);
+ w = TEXTW(tags[i], 0);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
- 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, 0);
if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
urg & 1 << i);
x += w;
}
- w = blw = TEXTW(m->ltsymbol);
+ w = blw = TEXTW(m->ltsymbol, 0);
drw_setscheme(drw, scheme[SchemeNorm]);
- x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
+ x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0, 0);
if ((w = m->ww - tw - x) > bh) {
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
- 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, 0);
if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
} else {