mirror of
https://github.com/kolunmi/dwlb.git
synced 2025-10-27 02:04:24 +00:00
rename color vars/options and add inactive_fg_color
This commit is contained in:
parent
6ff69669c3
commit
fac42b84ab
11
config.def.h
11
config.def.h
@ -12,8 +12,9 @@ static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
|||||||
// set 16-bit colors for bar
|
// set 16-bit colors for bar
|
||||||
// 8-bit color can be converted to 16-bit color by simply duplicating values e.g
|
// 8-bit color can be converted to 16-bit color by simply duplicating values e.g
|
||||||
// 0x55 -> 0x5555, 0xf1 -> 0xf1f1
|
// 0x55 -> 0x5555, 0xf1 -> 0xf1f1
|
||||||
static pixman_color_t activecolor = { .red = 0x0000, .green = 0x5555, .blue = 0x7777, .alpha = 0xffff, };
|
static pixman_color_t active_fg_color = { .red = 0xeeee, .green = 0xeeee, .blue = 0xeeee, .alpha = 0xffff, };
|
||||||
static pixman_color_t inactivecolor = { .red = 0x2222, .green = 0x2222, .blue = 0x2222, .alpha = 0xffff, };
|
static pixman_color_t active_bg_color = { .red = 0x0000, .green = 0x5555, .blue = 0x7777, .alpha = 0xffff, };
|
||||||
static pixman_color_t textcolor = { .red = 0xeeee, .green = 0xeeee, .blue = 0xeeee, .alpha = 0xffff, };
|
static pixman_color_t inactive_fg_color = { .red = 0xbbbb, .green = 0xbbbb, .blue = 0xbbbb, .alpha = 0xffff, };
|
||||||
static pixman_color_t urgbgcolor = { .red = 0xeeee, .green = 0xeeee, .blue = 0xeeee, .alpha = 0xffff, };
|
static pixman_color_t inactive_bg_color = { .red = 0x2222, .green = 0x2222, .blue = 0x2222, .alpha = 0xffff, };
|
||||||
static pixman_color_t urgtextcolor = { .red = 0x2222, .green = 0x2222, .blue = 0x2222, .alpha = 0xffff, };
|
static pixman_color_t urgent_fg_color = { .red = 0x2222, .green = 0x2222, .blue = 0x2222, .alpha = 0xffff, };
|
||||||
|
static pixman_color_t urgent_bg_color = { .red = 0xeeee, .green = 0xeeee, .blue = 0xeeee, .alpha = 0xffff, };
|
||||||
|
|||||||
80
dwlb.c
80
dwlb.c
@ -60,11 +60,12 @@
|
|||||||
" -hidden bars will initially be hidden\n" \
|
" -hidden bars will initially be hidden\n" \
|
||||||
" -bottom bars will initially be drawn at the bottom\n" \
|
" -bottom bars will initially be drawn at the bottom\n" \
|
||||||
" -font [FONT] specify a font\n" \
|
" -font [FONT] specify a font\n" \
|
||||||
" -text-color [COLOR] specify text color\n" \
|
" -active-fg-color [COLOR] specify text color of active tags or monitors\n" \
|
||||||
" -active-color [COLOR] specify color to indicate active tags or monitors\n" \
|
" -active-bg-color [COLOR] specify background color of active tags or monitors\n" \
|
||||||
" -inactive-color [COLOR] specify color to indicate inactive tags or monitors\n" \
|
" -inactive-fg-color [COLOR] specify text color of inactive tags or monitors\n" \
|
||||||
" -urg-text-color [COLOR] specify text color on urgent tags\n" \
|
" -inactive-fg-color [COLOR] specify background color of inactive tags or monitors\n" \
|
||||||
" -urg-bg-color [COLOR] specify color of urgent tags\n" \
|
" -urgent-fg-color [COLOR] specify text color of urgent tags\n" \
|
||||||
|
" -urgent-bg-color [COLOR] specify background color of urgent tags\n" \
|
||||||
" -tags [FIRST TAG]...[LAST TAG] specify custom tag names\n" \
|
" -tags [FIRST TAG]...[LAST TAG] specify custom tag names\n" \
|
||||||
"Commands\n" \
|
"Commands\n" \
|
||||||
" -status [OUTPUT] [TEXT] set status text\n" \
|
" -status [OUTPUT] [TEXT] set status text\n" \
|
||||||
@ -399,36 +400,36 @@ draw_frame(Bar *b)
|
|||||||
|
|
||||||
if (hide_vacant && !active && !occupied && !urgent)
|
if (hide_vacant && !active && !occupied && !urgent)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
pixman_color_t *fg_color = urgent ? &urgent_fg_color : (active ? &active_fg_color : &inactive_fg_color);
|
||||||
|
pixman_color_t *bg_color = urgent ? &urgent_bg_color : (active ? &active_bg_color : &inactive_bg_color);
|
||||||
|
|
||||||
if (!hide_vacant && occupied)
|
if (!hide_vacant && occupied)
|
||||||
pixman_image_fill_boxes(PIXMAN_OP_SRC, foreground,
|
pixman_image_fill_boxes(PIXMAN_OP_SRC, foreground,
|
||||||
&textcolor, 1, &(pixman_box32_t){
|
fg_color, 1, &(pixman_box32_t){
|
||||||
.x1 = xpos_left + boxs, .x2 = xpos_left + boxs + boxw,
|
.x1 = xpos_left + boxs, .x2 = xpos_left + boxs + boxw,
|
||||||
.y1 = boxs, .y2 = boxs + boxw
|
.y1 = boxs, .y2 = boxs + boxw
|
||||||
});
|
});
|
||||||
|
|
||||||
if (urgent)
|
xpos_left = draw_text(tags[i], xpos_left, ypos, foreground, background, fg_color,
|
||||||
xpos_left = draw_text(tags[i], xpos_left, ypos, foreground, background, &urgtextcolor,
|
bg_color, b->width, b->height, b->textpadding, false);
|
||||||
&urgbgcolor, b->width, b->height, b->textpadding, false);
|
|
||||||
else
|
|
||||||
xpos_left = draw_text(tags[i], xpos_left, ypos, foreground, background, &textcolor,
|
|
||||||
active ? &activecolor : &inactivecolor, b->width, b->height,
|
|
||||||
b->textpadding, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xpos_left = draw_text(b->layout, xpos_left, ypos, foreground, background, &textcolor,
|
xpos_left = draw_text(b->layout, xpos_left, ypos, foreground, background, &inactive_fg_color,
|
||||||
&inactivecolor, b->width, b->height, b->textpadding, false);
|
&inactive_bg_color, b->width, b->height, b->textpadding, false);
|
||||||
|
|
||||||
uint32_t status_width = TEXT_WIDTH(b->status, b->width - xpos_left, b->textpadding, true);
|
uint32_t status_width = TEXT_WIDTH(b->status, b->width - xpos_left, b->textpadding, true);
|
||||||
draw_text(b->status, b->width - status_width, ypos, foreground, background, &textcolor,
|
draw_text(b->status, b->width - status_width, ypos, foreground,
|
||||||
&inactivecolor, b->width, b->height, b->textpadding, true);
|
background, &inactive_fg_color, &inactive_bg_color,
|
||||||
|
b->width, b->height, b->textpadding, true);
|
||||||
|
|
||||||
xpos_left = draw_text(b->title, xpos_left, ypos, foreground, background, &textcolor,
|
xpos_left = draw_text(b->title, xpos_left, ypos, foreground, background,
|
||||||
b->selmon ? &activecolor : &inactivecolor, b->width - status_width,
|
b->selmon ? &active_fg_color : &inactive_fg_color,
|
||||||
b->height, b->textpadding, false);
|
b->selmon ? &active_bg_color : &inactive_bg_color,
|
||||||
|
b->width - status_width, b->height, b->textpadding, false);
|
||||||
|
|
||||||
pixman_image_fill_boxes(PIXMAN_OP_SRC, background,
|
pixman_image_fill_boxes(PIXMAN_OP_SRC, background,
|
||||||
b->selmon ? &activecolor : &inactivecolor, 1,
|
b->selmon ? &active_bg_color : &inactive_bg_color, 1,
|
||||||
&(pixman_box32_t){
|
&(pixman_box32_t){
|
||||||
.x1 = xpos_left, .x2 = b->width - status_width,
|
.x1 = xpos_left, .x2 = b->width - status_width,
|
||||||
.y1 = 0, .y2 = b->height
|
.y1 = 0, .y2 = b->height
|
||||||
@ -1038,30 +1039,35 @@ main(int argc, char **argv)
|
|||||||
if (++i >= argc)
|
if (++i >= argc)
|
||||||
DIE("Option -font requires an argument");
|
DIE("Option -font requires an argument");
|
||||||
fontstr = argv[i];
|
fontstr = argv[i];
|
||||||
} else if (!strcmp(argv[i], "-text-color")) {
|
} else if (!strcmp(argv[i], "-active-fg-color")) {
|
||||||
if (++i >= argc)
|
if (++i >= argc)
|
||||||
DIE("Option -text-color requires an argument");
|
DIE("Option -active-fg-color requires an argument");
|
||||||
if (parse_color(argv[i], &textcolor) == -1)
|
if (parse_color(argv[i], &active_fg_color) == -1)
|
||||||
DIE("malformed color string");
|
DIE("malformed color string");
|
||||||
} else if (!strcmp(argv[i], "-active-color")) {
|
} else if (!strcmp(argv[i], "-active-bg-color")) {
|
||||||
if (++i >= argc)
|
if (++i >= argc)
|
||||||
DIE("Option -active-color requires an argument");
|
DIE("Option -active-bg-color requires an argument");
|
||||||
if (parse_color(argv[i], &activecolor) == -1)
|
if (parse_color(argv[i], &active_bg_color) == -1)
|
||||||
DIE("malformed color string");
|
DIE("malformed color string");
|
||||||
} else if (!strcmp(argv[i], "-inactive-color")) {
|
} else if (!strcmp(argv[i], "-inactive-fg-color")) {
|
||||||
if (++i >= argc)
|
if (++i >= argc)
|
||||||
DIE("Option -inactive-color requires an argument");
|
DIE("Option -inactive-fg-color requires an argument");
|
||||||
if (parse_color(argv[i], &inactivecolor) == -1)
|
if (parse_color(argv[i], &inactive_fg_color) == -1)
|
||||||
DIE("malformed color string");
|
DIE("malformed color string");
|
||||||
} else if (!strcmp(argv[i], "-urg-text-color")) {
|
} else if (!strcmp(argv[i], "-inactive-bg-color")) {
|
||||||
if (++i >= argc)
|
if (++i >= argc)
|
||||||
DIE("Option -urg-text-color requires an argument");
|
DIE("Option -inactive-bg-color requires an argument");
|
||||||
if (parse_color(argv[i], &urgtextcolor) == -1)
|
if (parse_color(argv[i], &inactive_bg_color) == -1)
|
||||||
DIE("malformed color string");
|
DIE("malformed color string");
|
||||||
} else if (!strcmp(argv[i], "-urg-bg-color")) {
|
} else if (!strcmp(argv[i], "-urgent-fg-color")) {
|
||||||
if (++i >= argc)
|
if (++i >= argc)
|
||||||
DIE("Option -urg-bg-color requires an argument");
|
DIE("Option -urgent-fg-color requires an argument");
|
||||||
if (parse_color(argv[i], &urgbgcolor) == -1)
|
if (parse_color(argv[i], &urgent_fg_color) == -1)
|
||||||
|
DIE("malformed color string");
|
||||||
|
} else if (!strcmp(argv[i], "-urgent-bg-color")) {
|
||||||
|
if (++i >= argc)
|
||||||
|
DIE("Option -urgent-bg-color requires an argument");
|
||||||
|
if (parse_color(argv[i], &urgent_bg_color) == -1)
|
||||||
DIE("malformed color string");
|
DIE("malformed color string");
|
||||||
} else if (!strcmp(argv[i], "-tags")) {
|
} else if (!strcmp(argv[i], "-tags")) {
|
||||||
if (i + (int)LENGTH(tags) >= argc)
|
if (i + (int)LENGTH(tags) >= argc)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user