Added Color Status Patch and set Ubuntu Awesome Fonts

This commit is contained in:
Linux User 2022-08-16 10:10:53 +00:00
parent adc415215e
commit 5354bf1928
5 changed files with 111 additions and 110 deletions

View File

@ -2,9 +2,6 @@
/* appearance */ /* appearance */
#define FONT "JetBrainsMono Nerd Font"
#define FONTSIZE "10"
static const unsigned int borderpx = 4; static const unsigned int borderpx = 4;
static const unsigned int gappx = 10; static const unsigned int gappx = 10;
static const unsigned int snap = 32; /* snap pixel */ static const unsigned int snap = 32; /* snap pixel */
@ -12,8 +9,13 @@ static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */ static const int topbar = 1; /* 0 means bottom bar */
static const int horizpadbar = 5; static const int horizpadbar = 5;
static const int vertpadbar = 6; static const int vertpadbar = 6;
static const char *fonts[] = { FONT":size=10", "Symbols Nerd Font:size=20" }; static const int vertpadstat = 0;
static const char dmenufont[] = FONT":size="FONTSIZE; static const char *fonts[] = {
"Ubuntu Mono:style=Bold:size=10:antialias=true:autohint=true",
"Font Awesome 6 Free Solid:style=Solid:size=10:antialias=true:autohint=true",
"Font Awesome 6 Brands Regular:style=Regular:size=10:antialias=true:autohint=true"
};
static const char dmenufont[] = "Ubuntu Mono:size=10";
static const char col_gray1[] = "#222222"; static const char col_gray1[] = "#222222";
static const char col_gray2[] = "#444444"; static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb"; static const char col_gray3[] = "#bbbbbb";
@ -26,7 +28,7 @@ static const char *colors[][3] = {
}; };
/* tagging */ /* tagging */
static const char *tags[] = { "", "", "3", "", "5", "6", "7", "8", "" }; static const char *tags[] = { "", "", "3", "", "5", "6", "7", "8", "" };
static const Rule rules[] = { static const Rule rules[] = {
/* xprop(1): /* xprop(1):
@ -65,7 +67,7 @@ static const Layout layouts[] = {
/* commands */ /* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-g", "10", /* "-z", "20", */ "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; static const char *dmenucmd[] = { "dmenu_run", "-g", "10", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "st", NULL }; static const char *termcmd[] = { "st", NULL };
static Key keys[] = { static Key keys[] = {

View File

@ -2,9 +2,6 @@
/* appearance */ /* appearance */
#define FONT "JetBrainsMono Nerd Font"
#define FONTSIZE "10"
static const unsigned int borderpx = 4; static const unsigned int borderpx = 4;
static const unsigned int gappx = 10; static const unsigned int gappx = 10;
static const unsigned int snap = 32; /* snap pixel */ static const unsigned int snap = 32; /* snap pixel */
@ -12,8 +9,13 @@ static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */ static const int topbar = 1; /* 0 means bottom bar */
static const int horizpadbar = 5; static const int horizpadbar = 5;
static const int vertpadbar = 6; static const int vertpadbar = 6;
static const char *fonts[] = { FONT":size=10", "Symbols Nerd Font:size=20" }; static const int vertpadstat = 0;
static const char dmenufont[] = FONT":size="FONTSIZE; static const char *fonts[] = {
"Ubuntu Mono:style=Bold:size=10:antialias=true:autohint=true",
"Font Awesome 6 Free Solid:style=Solid:size=10:antialias=true:autohint=true",
"Font Awesome 6 Brands Regular:style=Regular:size=10:antialias=true:autohint=true"
};
static const char dmenufont[] = "Ubuntu Mono:size=10";
static const char col_gray1[] = "#222222"; static const char col_gray1[] = "#222222";
static const char col_gray2[] = "#444444"; static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb"; static const char col_gray3[] = "#bbbbbb";
@ -26,7 +28,7 @@ static const char *colors[][3] = {
}; };
/* tagging */ /* tagging */
static const char *tags[] = { "", "", "3", "", "5", "6", "7", "8", "" }; static const char *tags[] = { "", "", "3", "", "5", "6", "7", "8", "" };
static const Rule rules[] = { static const Rule rules[] = {
/* xprop(1): /* xprop(1):
@ -65,7 +67,7 @@ static const Layout layouts[] = {
/* commands */ /* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-g", "10", /* "-z", "20", */ "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; static const char *dmenucmd[] = { "dmenu_run", "-g", "10", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "st", NULL }; static const char *termcmd[] = { "st", NULL };
static Key keys[] = { static Key keys[] = {

BIN
dwm

Binary file not shown.

189
dwm.c
View File

@ -700,116 +700,113 @@ dirtomon(int dir)
return m; return m;
} }
void int
drawstatusbar(Monitor *m, int bh, char* stext) { drawstatusbar(Monitor *m, int bh, char* stext) {
int ret, i, w, x, len; int ret, i, w, x, len;
short isCode = 0; short isCode = 0;
char *text; char *text;
char *p; char *p;
len = strlen(stext) + 1 ; len = strlen(stext) + 1 ;
if (!(text = (char*) malloc(sizeof(char)*len))) if (!(text = (char*) malloc(sizeof(char)*len)))
die("malloc"); die("malloc");
p = text; p = text;
memcpy(text, stext, len); memcpy(text, stext, len);
/* compute width of the status text */ /* compute width of the status text */
w = 0; w = 0;
i = -1; i = -1;
while (text[++i]) { while (text[++i]) {
if (text[i] == '^') { if (text[i] == '^') {
if (!isCode) { if (!isCode) {
isCode = 1; isCode = 1;
text[i] = '\0'; text[i] = '\0';
w += TEXTW(text) - lrpad; w += TEXTW(text) - lrpad;
text[i] = '^'; text[i] = '^';
if (text[++i] == 'f') if (text[++i] == 'f')
w += atoi(text + ++i); w += atoi(text + ++i);
} else { } else {
isCode = 0; isCode = 0;
text = text + i + 1; text = text + i + 1;
i = -1; i = -1;
} }
} }
} }
if (!isCode) if (!isCode)
w += TEXTW(text) - lrpad; w += TEXTW(text) - lrpad;
else else
isCode = 0; isCode = 0;
text = p; text = p;
w += 2; /* 1px pad on sides */ // MAYBE THAT DELETE w += 2; /* 1px padding on both sides */
ret = x = m->ww - w; ret = m->ww - w;
x = m->ww - w - 2 * vpb;
drw_setscheme(drw, scheme[LENGTH(colors)]); drw_setscheme(drw, scheme[LENGTH(colors)]);
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg]; drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg]; drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
drw_rect(drw, x, 0, w, bh, 1, 1); drw_rect(drw, x, 0, w, bh, 1, 1);
x++; x++;
/* process status text */ /* process status text */
i = -1; i = -1;
while (text[++i]) { while (text[++i]) {
if (text[i] == '^' && !isCode) { if (text[i] == '^' && !isCode) {
isCode = 1; isCode = 1;
text[i] = '\0'; text[i] = '\0';
w = TEXTW(text) - lrpad; w = TEXTW(text) - lrpad;
drw_text(drw, x, 0, w, bh, 0, text, 0); drw_text(drw, x, vertpadstat, w, bh - 2 * vertpadstat, 0, text, 0);
x += w; x += w;
/* process code */ /* process code */
while (text[++i] != '^') { while (text[++i] != '^') {
if (text[i] == 'c') { if (text[i] == 'c') {
char buf[8]; char buf[8];
memcpy(buf, (char*)text+i+1, 7); memcpy(buf, (char*)text+i+1, 7);
buf[7] = '\0'; buf[7] = '\0';
drw_clr_create(drw, &drw->scheme[ColFg], buf); drw_clr_create(drw, &drw->scheme[ColFg], buf);
i += 7; i += 7;
} else if (text[i] == 'b') { } else if (text[i] == 'b') {
char buf[8]; char buf[8];
memcpy(buf, (char*)text+i+1, 7); memcpy(buf, (char*)text+i+1, 7);
buf[7] = '\0'; buf[7] = '\0';
drw_clr_create(drw, &drw->scheme[ColBg], buf); drw_clr_create(drw, &drw->scheme[ColBg], buf);
i += 7; i += 7;
} else if (text[i] == 'd') { } else if (text[i] == 'd') {
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg]; drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg]; drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
} else if (text[i] == 'r') { } else if (text[i] == 'r') {
int rx = atoi(text + ++i); int rx = atoi(text + ++i);
while (text[++i] != ','); while (text[++i] != ',');
int ry = atoi(text + ++i); int ry = atoi(text + ++i);
while (text[++i] != ','); while (text[++i] != ',');
int rw = atoi(text + ++i); int rw = atoi(text + ++i);
while (text[++i] != ','); while (text[++i] != ',');
int rh = atoi(text + ++i); int rh = atoi(text + ++i);
drw_rect(drw, rx + x, ry, rw, rh, 1, 0); drw_rect(drw, rx + x, ry, rw, rh, 1, 0);
} else if (text[i] == 'f') { } else if (text[i] == 'f') {
x += atoi(text + ++i); x += atoi(text + ++i);
} }
} }
text = text + i + 1; text = text + i + 1;
i=-1; i=-1;
isCode = 0; isCode = 0;
} }
} }
if (!isCode) { if (!isCode) {
// w = TEXTW(text) - lrpad; w = TEXTW(text) - lrpad;
w = TEXTW(text); // THIS ROW drw_text(drw, x, 0, w, bh, 0, text, 0);
// drw_text(drw, m->ww - tw , 0, tw, bh, 0 , text, 0); }
// drw_text(drw, m->ww - tw - 2 * hpb, 0, tw, bh, lrpad / 2, text, 0);
// drw_text(drw, x , 0, w , bh, 0 , text, 0);
drw_text(drw, x - 2 * hpb , 0, w , bh, lrpad / 2, text, 0); // THIS ROW
}
drw_setscheme(drw, scheme[SchemeNorm]); drw_setscheme(drw, scheme[SchemeNorm]);
free(p); free(p);
return ret; return ret;
} }
void void

BIN
dwm.o

Binary file not shown.