Added Color Status Patch and set Ubuntu Awesome Fonts
This commit is contained in:
parent
adc415215e
commit
5354bf1928
16
config.def.h
16
config.def.h
|
@ -2,9 +2,6 @@
|
|||
|
||||
/* appearance */
|
||||
|
||||
#define FONT "JetBrainsMono Nerd Font"
|
||||
#define FONTSIZE "10"
|
||||
|
||||
static const unsigned int borderpx = 4;
|
||||
static const unsigned int gappx = 10;
|
||||
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 horizpadbar = 5;
|
||||
static const int vertpadbar = 6;
|
||||
static const char *fonts[] = { FONT":size=10", "Symbols Nerd Font:size=20" };
|
||||
static const char dmenufont[] = FONT":size="FONTSIZE;
|
||||
static const int vertpadstat = 0;
|
||||
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_gray2[] = "#444444";
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
|
@ -26,7 +28,7 @@ static const char *colors[][3] = {
|
|||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "", "", "3", "", "5", "6", "7", "8", "" };
|
||||
static const char *tags[] = { "", "", "3", "", "5", "6", "7", "8", "" };
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
|
@ -65,7 +67,7 @@ static const Layout layouts[] = {
|
|||
|
||||
/* commands */
|
||||
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 Key keys[] = {
|
||||
|
|
16
config.h
16
config.h
|
@ -2,9 +2,6 @@
|
|||
|
||||
/* appearance */
|
||||
|
||||
#define FONT "JetBrainsMono Nerd Font"
|
||||
#define FONTSIZE "10"
|
||||
|
||||
static const unsigned int borderpx = 4;
|
||||
static const unsigned int gappx = 10;
|
||||
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 horizpadbar = 5;
|
||||
static const int vertpadbar = 6;
|
||||
static const char *fonts[] = { FONT":size=10", "Symbols Nerd Font:size=20" };
|
||||
static const char dmenufont[] = FONT":size="FONTSIZE;
|
||||
static const int vertpadstat = 0;
|
||||
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_gray2[] = "#444444";
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
|
@ -26,7 +28,7 @@ static const char *colors[][3] = {
|
|||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "", "", "3", "", "5", "6", "7", "8", "" };
|
||||
static const char *tags[] = { "", "", "3", "", "5", "6", "7", "8", "" };
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
|
@ -65,7 +67,7 @@ static const Layout layouts[] = {
|
|||
|
||||
/* commands */
|
||||
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 Key keys[] = {
|
||||
|
|
189
dwm.c
189
dwm.c
|
@ -700,116 +700,113 @@ dirtomon(int dir)
|
|||
return m;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
drawstatusbar(Monitor *m, int bh, char* stext) {
|
||||
int ret, i, w, x, len;
|
||||
short isCode = 0;
|
||||
char *text;
|
||||
char *p;
|
||||
int ret, i, w, x, len;
|
||||
short isCode = 0;
|
||||
char *text;
|
||||
char *p;
|
||||
|
||||
len = strlen(stext) + 1 ;
|
||||
if (!(text = (char*) malloc(sizeof(char)*len)))
|
||||
die("malloc");
|
||||
p = text;
|
||||
memcpy(text, stext, len);
|
||||
len = strlen(stext) + 1 ;
|
||||
if (!(text = (char*) malloc(sizeof(char)*len)))
|
||||
die("malloc");
|
||||
p = text;
|
||||
memcpy(text, stext, len);
|
||||
|
||||
/* compute width of the status text */
|
||||
w = 0;
|
||||
i = -1;
|
||||
while (text[++i]) {
|
||||
if (text[i] == '^') {
|
||||
if (!isCode) {
|
||||
isCode = 1;
|
||||
text[i] = '\0';
|
||||
w += TEXTW(text) - lrpad;
|
||||
text[i] = '^';
|
||||
if (text[++i] == 'f')
|
||||
w += atoi(text + ++i);
|
||||
} else {
|
||||
isCode = 0;
|
||||
text = text + i + 1;
|
||||
i = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isCode)
|
||||
w += TEXTW(text) - lrpad;
|
||||
else
|
||||
isCode = 0;
|
||||
text = p;
|
||||
/* compute width of the status text */
|
||||
w = 0;
|
||||
i = -1;
|
||||
while (text[++i]) {
|
||||
if (text[i] == '^') {
|
||||
if (!isCode) {
|
||||
isCode = 1;
|
||||
text[i] = '\0';
|
||||
w += TEXTW(text) - lrpad;
|
||||
text[i] = '^';
|
||||
if (text[++i] == 'f')
|
||||
w += atoi(text + ++i);
|
||||
} else {
|
||||
isCode = 0;
|
||||
text = text + i + 1;
|
||||
i = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isCode)
|
||||
w += TEXTW(text) - lrpad;
|
||||
else
|
||||
isCode = 0;
|
||||
text = p;
|
||||
|
||||
w += 2; /* 1px pad on sides */ // MAYBE THAT DELETE
|
||||
ret = x = m->ww - w;
|
||||
w += 2; /* 1px padding on both sides */
|
||||
ret = m->ww - w;
|
||||
x = m->ww - w - 2 * vpb;
|
||||
|
||||
drw_setscheme(drw, scheme[LENGTH(colors)]);
|
||||
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
|
||||
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
x++;
|
||||
drw_setscheme(drw, scheme[LENGTH(colors)]);
|
||||
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
|
||||
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
x++;
|
||||
|
||||
/* process status text */
|
||||
i = -1;
|
||||
while (text[++i]) {
|
||||
if (text[i] == '^' && !isCode) {
|
||||
isCode = 1;
|
||||
/* process status text */
|
||||
i = -1;
|
||||
while (text[++i]) {
|
||||
if (text[i] == '^' && !isCode) {
|
||||
isCode = 1;
|
||||
|
||||
text[i] = '\0';
|
||||
w = TEXTW(text) - lrpad;
|
||||
drw_text(drw, x, 0, w, bh, 0, text, 0);
|
||||
text[i] = '\0';
|
||||
w = TEXTW(text) - lrpad;
|
||||
drw_text(drw, x, vertpadstat, w, bh - 2 * vertpadstat, 0, text, 0);
|
||||
|
||||
x += w;
|
||||
x += w;
|
||||
|
||||
/* process code */
|
||||
while (text[++i] != '^') {
|
||||
if (text[i] == 'c') {
|
||||
char buf[8];
|
||||
memcpy(buf, (char*)text+i+1, 7);
|
||||
buf[7] = '\0';
|
||||
drw_clr_create(drw, &drw->scheme[ColFg], buf);
|
||||
i += 7;
|
||||
} else if (text[i] == 'b') {
|
||||
char buf[8];
|
||||
memcpy(buf, (char*)text+i+1, 7);
|
||||
buf[7] = '\0';
|
||||
drw_clr_create(drw, &drw->scheme[ColBg], buf);
|
||||
i += 7;
|
||||
} else if (text[i] == 'd') {
|
||||
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
|
||||
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
|
||||
} else if (text[i] == 'r') {
|
||||
int rx = atoi(text + ++i);
|
||||
while (text[++i] != ',');
|
||||
int ry = atoi(text + ++i);
|
||||
while (text[++i] != ',');
|
||||
int rw = atoi(text + ++i);
|
||||
while (text[++i] != ',');
|
||||
int rh = atoi(text + ++i);
|
||||
/* process code */
|
||||
while (text[++i] != '^') {
|
||||
if (text[i] == 'c') {
|
||||
char buf[8];
|
||||
memcpy(buf, (char*)text+i+1, 7);
|
||||
buf[7] = '\0';
|
||||
drw_clr_create(drw, &drw->scheme[ColFg], buf);
|
||||
i += 7;
|
||||
} else if (text[i] == 'b') {
|
||||
char buf[8];
|
||||
memcpy(buf, (char*)text+i+1, 7);
|
||||
buf[7] = '\0';
|
||||
drw_clr_create(drw, &drw->scheme[ColBg], buf);
|
||||
i += 7;
|
||||
} else if (text[i] == 'd') {
|
||||
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
|
||||
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
|
||||
} else if (text[i] == 'r') {
|
||||
int rx = atoi(text + ++i);
|
||||
while (text[++i] != ',');
|
||||
int ry = atoi(text + ++i);
|
||||
while (text[++i] != ',');
|
||||
int rw = atoi(text + ++i);
|
||||
while (text[++i] != ',');
|
||||
int rh = atoi(text + ++i);
|
||||
|
||||
drw_rect(drw, rx + x, ry, rw, rh, 1, 0);
|
||||
} else if (text[i] == 'f') {
|
||||
x += atoi(text + ++i);
|
||||
}
|
||||
}
|
||||
drw_rect(drw, rx + x, ry, rw, rh, 1, 0);
|
||||
} else if (text[i] == 'f') {
|
||||
x += atoi(text + ++i);
|
||||
}
|
||||
}
|
||||
|
||||
text = text + i + 1;
|
||||
i=-1;
|
||||
isCode = 0;
|
||||
}
|
||||
}
|
||||
text = text + i + 1;
|
||||
i=-1;
|
||||
isCode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCode) {
|
||||
// w = TEXTW(text) - lrpad;
|
||||
w = TEXTW(text); // THIS ROW
|
||||
// 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
|
||||
}
|
||||
if (!isCode) {
|
||||
w = TEXTW(text) - lrpad;
|
||||
drw_text(drw, x, 0, w, bh, 0, text, 0);
|
||||
}
|
||||
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
free(p);
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
free(p);
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue