sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-statusbarfont-6.2.diff (6226B)


      1 diff -up dwm-6.2/config.def.h dwm-patched/config.def.h
      2 --- dwm-6.2/config.def.h	2019-02-02 13:55:28.000000000 +0100
      3 +++ dwm-patched/config.def.h	2021-11-01 07:14:26.678879225 +0100
      4 @@ -5,7 +5,10 @@ static const unsigned int borderpx  = 1;
      5  static const unsigned int snap      = 32;       /* snap pixel */
      6  static const int showbar            = 1;        /* 0 means no bar */
      7  static const int topbar             = 1;        /* 0 means bottom bar */
      8 -static const char *fonts[]          = { "monospace:size=10" };
      9 +static const char *fonts[]          = { "monospace:size=10",
     10 +		"Symbola:size=10:antialias=true:autohint=truAe",
     11 +		"Monospace:size=8:antialias=true:autohint=true"};
     12 +static const int statusfontindex =2; //Select font of font list to use for statusbar
     13  static const char dmenufont[]       = "monospace:size=10";
     14  static const char col_gray1[]       = "#222222";
     15  static const char col_gray2[]       = "#444444";
     16 Only in dwm-patched/: config.h
     17 diff -up dwm-6.2/drw.c dwm-patched/drw.c
     18 --- dwm-6.2/drw.c	2019-02-02 13:55:28.000000000 +0100
     19 +++ dwm-patched/drw.c	2021-11-01 07:28:35.088863193 +0100
     20 @@ -248,7 +248,7 @@ drw_rect(Drw *drw, int x, int y, unsigne
     21  }
     22  
     23  int
     24 -drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
     25 +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)
     26  {
     27  	char buf[1024];
     28  	int ty;
     29 @@ -287,6 +287,8 @@ drw_text(Drw *drw, int x, int y, unsigne
     30  		nextfont = NULL;
     31  		while (*text) {
     32  			utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ);
     33 +			curfont = drw->fonts; 
     34 +			for (int i=0;i<fontindex;i++){ curfont = curfont->next ;}
     35  			for (curfont = drw->fonts; curfont; curfont = curfont->next) {
     36  				charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
     37  				if (charexists) {
     38 @@ -389,11 +391,11 @@ drw_map(Drw *drw, Window win, int x, int
     39  }
     40  
     41  unsigned int
     42 -drw_fontset_getwidth(Drw *drw, const char *text)
     43 +drw_fontset_getwidth(Drw *drw, const char *text ,int fontindex)
     44  {
     45  	if (!drw || !drw->fonts || !text)
     46  		return 0;
     47 -	return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
     48 +	return drw_text(drw, 0, 0, 0, 0, 0, text, 0,fontindex);
     49  }
     50  
     51  void
     52 diff -up dwm-6.2/drw.h dwm-patched/drw.h
     53 --- dwm-6.2/drw.h	2019-02-02 13:55:28.000000000 +0100
     54 +++ dwm-patched/drw.h	2021-11-01 07:35:14.478855688 +0100
     55 @@ -34,7 +34,7 @@ void drw_free(Drw *drw);
     56  /* Fnt abstraction */
     57  Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
     58  void drw_fontset_free(Fnt* set);
     59 -unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
     60 +unsigned int drw_fontset_getwidth(Drw *drw, const char *text, int fontindex);
     61  void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
     62  
     63  /* Colorscheme abstraction */
     64 @@ -51,7 +51,7 @@ void drw_setscheme(Drw *drw, Clr *scm);
     65  
     66  /* Drawing functions */
     67  void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
     68 -int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert);
     69 +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);
     70  
     71  /* Map functions */
     72  void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
     73 Only in dwm-patched/: drw.o
     74 Only in dwm-patched/: dwm
     75 diff -up dwm-6.2/dwm.c dwm-patched/dwm.c
     76 --- dwm-6.2/dwm.c	2019-02-02 13:55:28.000000000 +0100
     77 +++ dwm-patched/dwm.c	2021-11-01 07:37:57.572185949 +0100
     78 @@ -55,7 +55,7 @@
     79  #define WIDTH(X)                ((X)->w + 2 * (X)->bw)
     80  #define HEIGHT(X)               ((X)->h + 2 * (X)->bw)
     81  #define TAGMASK                 ((1 << LENGTH(tags)) - 1)
     82 -#define TEXTW(X)                (drw_fontset_getwidth(drw, (X)) + lrpad)
     83 +#define TEXTW(X,F)                (drw_fontset_getwidth(drw, (X),(F)) + lrpad)
     84  
     85  /* enums */
     86  enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
     87 @@ -432,14 +432,14 @@ buttonpress(XEvent *e)
     88  	if (ev->window == selmon->barwin) {
     89  		i = x = 0;
     90  		do
     91 -			x += TEXTW(tags[i]);
     92 +			x += TEXTW(tags[i],0);
     93  		while (ev->x >= x && ++i < LENGTH(tags));
     94  		if (i < LENGTH(tags)) {
     95  			click = ClkTagBar;
     96  			arg.ui = 1 << i;
     97  		} else if (ev->x < x + blw)
     98  			click = ClkLtSymbol;
     99 -		else if (ev->x > selmon->ww - TEXTW(stext))
    100 +		else if (ev->x > selmon->ww - TEXTW(stext,statusfontindex))
    101  			click = ClkStatusText;
    102  		else
    103  			click = ClkWinTitle;
    104 @@ -704,8 +704,8 @@ drawbar(Monitor *m)
    105  	/* draw status first so it can be overdrawn by tags later */
    106  	if (m == selmon) { /* status is only drawn on selected monitor */
    107  		drw_setscheme(drw, scheme[SchemeNorm]);
    108 -		sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
    109 -		drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
    110 +		sw = TEXTW(stext,statusfontindex) - lrpad + 2; /* 2px right padding */
    111 +		drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0,statusfontindex);
    112  	}
    113  
    114  	for (c = m->clients; c; c = c->next) {
    115 @@ -715,23 +715,23 @@ drawbar(Monitor *m)
    116  	}
    117  	x = 0;
    118  	for (i = 0; i < LENGTH(tags); i++) {
    119 -		w = TEXTW(tags[i]);
    120 +		w = TEXTW(tags[i],0);
    121  		drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
    122 -		drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
    123 +		drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i,0);
    124  		if (occ & 1 << i)
    125  			drw_rect(drw, x + boxs, boxs, boxw, boxw,
    126  				m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
    127  				urg & 1 << i);
    128  		x += w;
    129  	}
    130 -	w = blw = TEXTW(m->ltsymbol);
    131 +	w = blw = TEXTW(m->ltsymbol,0);
    132  	drw_setscheme(drw, scheme[SchemeNorm]);
    133 -	x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
    134 +	x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0,0);
    135  
    136  	if ((w = m->ww - sw - x) > bh) {
    137  		if (m->sel) {
    138  			drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
    139 -			drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
    140 +			drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0,0);
    141  			if (m->sel->isfloating)
    142  				drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
    143  		} else {
    144 Only in dwm-patched/: dwm.o
    145 Only in dwm-patched/: util.o