[wiki] [sites] Added the dwm-statusbarfont for dwm-6.4 version || Wim Stockman

From: <git_AT_suckless.org>
Date: Mon, 18 Dec 2023 11:46:04 +0100

commit e6f6aee46a0fb429237b6a0c1f07923eae3d597b
Author: Wim Stockman <wim_AT_thinkerwim.org>
Date: Mon Dec 18 11:45:24 2023 +0100

    Added the dwm-statusbarfont for dwm-6.4 version

diff --git a/dwm.suckless.org/patches/statusbarfont/dwm-statusbarfont-6.4.diff b/dwm.suckless.org/patches/statusbarfont/dwm-statusbarfont-6.4.diff
new file mode 100644
index 00000000..e2ab4a97
--- /dev/null
+++ b/dwm.suckless.org/patches/statusbarfont/dwm-statusbarfont-6.4.diff
_AT_@ -0,0 +1,191 @@
+diff -up /dwm-6.4/config.def.h ./config.def.h
+--- /dwm-6.4/config.def.h 2022-10-04 19:38:18.000000000 +0200
++++ ./config.def.h 2023-12-18 11:31:12.178928718 +0100
+_AT_@ -5,7 +5,11 @@ static const unsigned int borderpx = 1;
+ static const unsigned int snap = 32; /* snap pixel */
+ static const int showbar = 1; /* 0 means no bar */
+ static const int topbar = 1; /* 0 means bottom bar */
+-static const char *fonts[] = { "monospace:size=10" };
++static const char *fonts[] = {
++ "monospace:size=10",
++ "symbola:size=10:antialias=true:autohint=truAe",
++ "monospace:size=8:antialias=true:autohint=true"
++ };
+ static const char dmenufont[] = "monospace:size=10";
+ static const char col_gray1[] = "#222222";
+ static const char col_gray2[] = "#444444";
+_AT_@ -17,7 +21,9 @@ static const char *colors[][3] = {
+ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
+ [SchemeSel] = { col_gray4, col_cyan, col_cyan },
+ };
+-
++/* Select the font index for you statusbar
++ * the index is zero based*/
++static const int statusfontindex = 2;
+ /* tagging */
+ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+
+Only in .: config.h
+diff -up /dwm-6.4/drw.c ./drw.c
+--- /dwm-6.4/drw.c 2022-10-04 19:38:18.000000000 +0200
++++ ./drw.c 2023-12-18 11:20:02.648918951 +0100
+_AT_@ -236,7 +236,7 @@ drw_rect(Drw *drw, int x, int y, unsigne
+ }
+
+ 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, int statusfontindex )
+ {
+ int i, ty, ellipsis_x = 0;
+ unsigned int tmpw, ew, ellipsis_w = 0, ellipsis_len;
+_AT_@ -272,14 +272,16 @@ drw_text(Drw *drw, int x, int y, unsigne
+
+ usedfont = drw->fonts;
+ if (!ellipsis_width && render)
+- ellipsis_width = drw_fontset_getwidth(drw, "...");
++ ellipsis_width = drw_fontset_getwidth(drw, "...",0);
+ while (1) {
+ ew = ellipsis_len = utf8strlen = 0;
+ utf8str = text;
+ nextfont = NULL;
+ while (*text) {
+ utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ);
+- for (curfont = drw->fonts; curfont; curfont = curfont->next) {
++ curfont = drw->fonts;
++ for (int i=0;i<statusfontindex;i++) {curfont = curfont->next;}
++ for (; curfont; curfont = curfont->next) {
+ charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
+ if (charexists) {
+ drw_font_getexts(curfont, text, utf8charlen, &tmpw, NULL);
+_AT_@ -326,7 +328,7 @@ drw_text(Drw *drw, int x, int y, unsigne
+ w -= ew;
+ }
+ if (render && overflow)
+- drw_text(drw, ellipsis_x, y, ellipsis_w, h, 0, "...", invert);
++ drw_text(drw, ellipsis_x, y, ellipsis_w, h, 0, "...", invert,statusfontindex);
+
+ if (!*text || overflow) {
+ break;
+_AT_@ -395,19 +397,19 @@ drw_map(Drw *drw, Window win, int x, int
+ }
+
+ unsigned int
+-drw_fontset_getwidth(Drw *drw, const char *text)
++drw_fontset_getwidth(Drw *drw, const char *text,int statusfontindex)
+ {
+ 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,statusfontindex);
+ }
+
+ unsigned int
+-drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n)
++drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n, int statusfontindex)
+ {
+ unsigned int tmp = 0;
+ if (drw && drw->fonts && text && n)
+- tmp = drw_text(drw, 0, 0, 0, 0, 0, text, n);
++ tmp = drw_text(drw, 0, 0, 0, 0, 0, text, n,statusfontindex);
+ return MIN(n, tmp);
+ }
+
+diff -up /dwm-6.4/drw.h ./drw.h
+--- /dwm-6.4/drw.h 2022-10-04 19:38:18.000000000 +0200
++++ ./drw.h 2023-12-18 11:18:22.625584159 +0100
+_AT_@ -34,8 +34,8 @@ 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_clamp(Drw *drw, const char *text, unsigned int n);
++unsigned int drw_fontset_getwidth(Drw *drw, const char *text,int statusfontindex);
++unsigned int drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n, int statusfontindex);
+ void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
+
+ /* Colorscheme abstraction */
+_AT_@ -52,7 +52,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, int statusfontindex );
+
+ /* Map functions */
+ void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
+Only in .: drw.o
+Only in .: dwm
+diff -up /dwm-6.4/dwm.c ./dwm.c
+--- /dwm-6.4/dwm.c 2022-10-04 19:38:18.000000000 +0200
++++ ./dwm.c 2023-12-18 11:25:53.718924073 +0100
+_AT_@ -55,8 +55,7 @@
+ #define WIDTH(X) ((X)->w + 2 * (X)->bw)
+ #define HEIGHT(X) ((X)->h + 2 * (X)->bw)
+ #define TAGMASK ((1 << LENGTH(tags)) - 1)
+-#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 */
+ enum { SchemeNorm, SchemeSel }; /* color schemes */
+_AT_@ -435,14 +434,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 + TEXTW(selmon->ltsymbol))
++ } else if (ev->x < x + TEXTW(selmon->ltsymbol,0))
+ click = ClkLtSymbol;
+- else if (ev->x > selmon->ww - (int)TEXTW(stext))
++ else if (ev->x > selmon->ww - (int)TEXTW(stext,0))
+ click = ClkStatusText;
+ else
+ click = ClkWinTitle;
+_AT_@ -711,8 +710,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) {
+_AT_@ -722,23 +721,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 = TEXTW(m->ltsymbol);
++ w = 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 {
+Only in .: dwm.o
+Only in .: dwm-statusbarfont-6.4.diff
+Only in .: util.o
diff --git a/dwm.suckless.org/patches/statusbarfont/index.md b/dwm.suckless.org/patches/statusbarfont/index.md
index 3aab5131..6bd1345b 100644
--- a/dwm.suckless.org/patches/statusbarfont/index.md
+++ b/dwm.suckless.org/patches/statusbarfont/index.md
_AT_@ -8,6 +8,7 @@ Select a seperate font for the statusbar from the font list
 
 Download
 --------
+* [dwm-statusbarfont-6.4.diff](dwm-statusbarfont-6.4.diff) (2023-12-18)
 * [dwm-statusbarfont-6.2.diff](dwm-statusbarfont-6.2.diff) (2021-11-01)
 
 Author
Received on Mon Dec 18 2023 - 11:46:04 CET

This archive was generated by hypermail 2.3.0 : Mon Dec 18 2023 - 11:48:47 CET