Add Color for focused ws (thx phnom)
This commit is contained in:
parent
16f7574851
commit
52e70c3802
|
@ -53,7 +53,7 @@ Also, you should disable the internal workspace bar of *i3*(1), when using *i3ba
|
|||
|
||||
For now this happens with the following command-line-options:
|
||||
|
||||
*--color-bar-fg, --color-bar-bg, --color-active-ws-fg, --color-active-ws-bg, --color-inactive-ws-fg, --color-inactive-ws-bg, color-urgent-ws-bg, color-urgent-ws-fg*
|
||||
*--color-bar-fg, --color-bar-bg, --color-active-ws-fg, --color-active-ws-bg, --color-inactive-ws-fg, --color-inactive-ws-bg, --color-urgent-ws-bg, --color-urgent-ws-fg, --color-focus-ws-fg, --color-focus-ws-bg*
|
||||
|
||||
For each specified option you need to give a HEX-colorcode.
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ struct xcb_color_strings_t {
|
|||
char *active_ws_bg;
|
||||
char *inactive_ws_fg;
|
||||
char *inactive_ws_bg;
|
||||
char *focus_ws_bg;
|
||||
char *focus_ws_fg;
|
||||
char *urgent_ws_bg;
|
||||
char *urgent_ws_fg;
|
||||
};
|
||||
|
|
|
@ -75,6 +75,8 @@ static void free_colors(struct xcb_color_strings_t *colors) {
|
|||
FREE_COLOR(inactive_ws_bg);
|
||||
FREE_COLOR(urgent_ws_fg);
|
||||
FREE_COLOR(urgent_ws_bg);
|
||||
FREE_COLOR(focus_ws_fg);
|
||||
FREE_COLOR(focus_ws_bg);
|
||||
#undef FREE_COLOR
|
||||
}
|
||||
|
||||
|
@ -141,10 +143,12 @@ int main(int argc, char **argv) {
|
|||
{ "color-inactive-ws-bg", required_argument, 0, 'F' },
|
||||
{ "color-urgent-ws-bg", required_argument, 0, 'G' },
|
||||
{ "color-urgent-ws-fg", required_argument, 0, 'H' },
|
||||
{ "color-focus-ws-bg", required_argument, 0, 'I' },
|
||||
{ "color-focus-ws-fg", required_argument, 0, 'J' },
|
||||
{ NULL, 0, 0, 0}
|
||||
};
|
||||
|
||||
while ((opt = getopt_long(argc, argv, "s:c:d::mf:hvVA:B:C:D:E:F:G:H:", long_opt, &option_index)) != -1) {
|
||||
while ((opt = getopt_long(argc, argv, "s:c:d::mf:hvVA:B:C:D:E:F:G:H:I:J:", long_opt, &option_index)) != -1) {
|
||||
switch (opt) {
|
||||
case 's':
|
||||
socket_path = expand_path(optarg);
|
||||
|
@ -204,6 +208,12 @@ int main(int argc, char **argv) {
|
|||
case 'H':
|
||||
read_color(&colors.urgent_ws_fg);
|
||||
break;
|
||||
case 'I':
|
||||
read_color(&colors.focus_ws_bg);
|
||||
break;
|
||||
case 'J':
|
||||
read_color(&colors.focus_ws_fg);
|
||||
break;
|
||||
default:
|
||||
print_usage(argv[0]);
|
||||
exit(EXIT_SUCCESS);
|
||||
|
|
|
@ -76,6 +76,8 @@ struct xcb_colors_t {
|
|||
uint32_t inactive_ws_bg;
|
||||
uint32_t urgent_ws_bg;
|
||||
uint32_t urgent_ws_fg;
|
||||
uint32_t focus_ws_bg;
|
||||
uint32_t focus_ws_fg;
|
||||
};
|
||||
struct xcb_colors_t colors;
|
||||
|
||||
|
@ -276,6 +278,8 @@ void init_colors(const struct xcb_color_strings_t *new_colors) {
|
|||
PARSE_COLOR(inactive_ws_bg, "240000");
|
||||
PARSE_COLOR(urgent_ws_fg, "FFFFFF");
|
||||
PARSE_COLOR(urgent_ws_bg, "002400");
|
||||
PARSE_COLOR(focus_ws_fg, "FFFFFF");
|
||||
PARSE_COLOR(focus_ws_bg, "480000");
|
||||
#undef PARSE_COLOR
|
||||
}
|
||||
|
||||
|
@ -939,8 +943,13 @@ void draw_bars() {
|
|||
uint32_t fg_color = colors.inactive_ws_fg;
|
||||
uint32_t bg_color = colors.inactive_ws_bg;
|
||||
if (ws_walk->visible) {
|
||||
fg_color = colors.active_ws_fg;
|
||||
bg_color = colors.active_ws_bg;
|
||||
if (!ws_walk->focused) {
|
||||
fg_color = colors.active_ws_fg;
|
||||
bg_color = colors.active_ws_bg;
|
||||
} else {
|
||||
fg_color = colors.focus_ws_fg;
|
||||
bg_color = colors.focus_ws_bg;
|
||||
}
|
||||
}
|
||||
if (ws_walk->urgent) {
|
||||
DLOG("WS %s is urgent!\n", ws_walk->name);
|
||||
|
|
Loading…
Reference in New Issue