diff options
-rw-r--r-- | client/common/common.c | 12 | ||||
-rw-r--r-- | lib/bemenu.h | 2 | ||||
-rw-r--r-- | lib/menu.c | 4 | ||||
-rw-r--r-- | lib/renderers/cairo.h | 7 | ||||
-rw-r--r-- | lib/renderers/curses/curses.c | 3 |
5 files changed, 21 insertions, 7 deletions
diff --git a/client/common/common.c b/client/common/common.c index 72335e7..982f89a 100644 --- a/client/common/common.c +++ b/client/common/common.c @@ -95,7 +95,9 @@ usage(FILE *out, const char *name) " --hb defines the highlighted background color. (wx)\n" " --hf defines the highlighted foreground color. (wx)\n" " --sb defines the selected background color. (wx)\n" - " --sf defines the selected foreground color. (wx)\n", out); + " --sf defines the selected foreground color. (wx)\n" + " --scb defines the scrollbar background color. (wx)\n" + " --scf defines the scrollbar foreground color. (wx)\n", out); exit((out == stderr ? EXIT_FAILURE : EXIT_SUCCESS)); } @@ -132,6 +134,8 @@ parse_args(struct client *client, int *argc, char **argv[]) { "hf", required_argument, 0, 0x109 }, { "sb", required_argument, 0, 0x110 }, { "sf", required_argument, 0, 0x111 }, + { "scb", required_argument, 0, 0x114 }, + { "scf", required_argument, 0, 0x115 }, { "disco", no_argument, 0, 0x112 }, { 0, 0, 0, 0 } @@ -222,6 +226,12 @@ parse_args(struct client *client, int *argc, char **argv[]) case 0x111: client->colors[BM_COLOR_SELECTED_FG] = optarg; break; + case 0x114: + client->colors[BM_COLOR_SCROLLBAR_BG] = optarg; + break; + case 0x115: + client->colors[BM_COLOR_SCROLLBAR_FG] = optarg; + break; case 0x112: disco(); diff --git a/lib/bemenu.h b/lib/bemenu.h index 490132f..b5598d0 100644 --- a/lib/bemenu.h +++ b/lib/bemenu.h @@ -196,6 +196,8 @@ enum bm_color { BM_COLOR_HIGHLIGHTED_FG, BM_COLOR_SELECTED_BG, BM_COLOR_SELECTED_FG, + BM_COLOR_SCROLLBAR_BG, + BM_COLOR_SCROLLBAR_FG, BM_COLOR_LAST }; @@ -25,7 +25,9 @@ static const char *default_colors[BM_COLOR_LAST] = { "#121212", // BM_COLOR_HIGHLIGHTED_BG "#D81860", // BM_COLOR_HIGHLIGHTED_FG "#121212", // BM_COLOR_SELECTED_BG - "#D81860" // BM_COLOR_SELECTED_FG + "#D81860", // BM_COLOR_SELECTED_FG + "#121212", // BM_COLOR_SCROLLBAR_BG + "#D81860", // BM_COLOR_SCROLLBAR_FG }; /** diff --git a/lib/renderers/cairo.h b/lib/renderers/cairo.h index c135a51..1a4f7c2 100644 --- a/lib/renderers/cairo.h +++ b/lib/renderers/cairo.h @@ -252,16 +252,17 @@ bm_cairo_paint(struct cairo *cairo, uint32_t width, uint32_t height, uint32_t ma } if (menu->scrollbar && count > 0) { + bm_cairo_color_from_menu_color(menu, BM_COLOR_SCROLLBAR_BG, &paint.bg); + bm_cairo_color_from_menu_color(menu, BM_COLOR_SCROLLBAR_FG, &paint.fg); + uint32_t sheight = out_result->height - titleh; - bm_cairo_color_from_menu_color(menu, BM_COLOR_TITLE_FG, &paint.bg); cairo_set_source_rgba(cairo->cr, paint.bg.r, paint.bg.b, paint.bg.g, paint.bg.a); cairo_rectangle(cairo->cr, 0, titleh, 2, sheight); cairo_fill(cairo->cr); uint32_t size = sheight / lines; uint32_t percent = (menu->index / (float)(count - 1)) * (sheight - size); - bm_cairo_color_from_menu_color(menu, BM_COLOR_BG, &paint.bg); - cairo_set_source_rgba(cairo->cr, paint.bg.r, paint.bg.b, paint.bg.g, paint.bg.a); + cairo_set_source_rgba(cairo->cr, paint.fg.r, paint.fg.b, paint.fg.g, paint.fg.a); cairo_rectangle(cairo->cr, 0, titleh + percent, 2, size); cairo_fill(cairo->cr); } diff --git a/lib/renderers/curses/curses.c b/lib/renderers/curses/curses.c index bab031b..852eb88 100644 --- a/lib/renderers/curses/curses.c +++ b/lib/renderers/curses/curses.c @@ -207,8 +207,7 @@ render(const struct bm_menu *menu) if (menu->scrollbar) { attron(COLOR_PAIR(1)); uint32_t percent = (menu->index / (float)(count - 1)) * (displayed - 1); - for (uint32_t i = 0; i < displayed; ++i) - mvprintw(1 + i, 0, (i == percent ? "█" : "▒")); + mvprintw(1 + percent, 0, "▒"); attroff(COLOR_PAIR(1)); } } |