From 9c541d0b4261acd656171a03e6bfd2719f91286d Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Sun, 18 Jan 2015 00:59:44 +0200 Subject: Add --scrollbar option --- client/bemenu-run.c | 1 + client/bemenu.c | 1 + client/common/common.c | 8 +++++++- client/common/common.h | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) (limited to 'client') diff --git a/client/bemenu-run.c b/client/bemenu-run.c index a1cb5ef..8f25348 100644 --- a/client/bemenu-run.c +++ b/client/bemenu-run.c @@ -19,6 +19,7 @@ static struct client client = { .bottom = false, .grab = false, .wrap = false, + .scrollbar = false, }; struct paths { diff --git a/client/bemenu.c b/client/bemenu.c index 6a4f95d..37dc9e2 100644 --- a/client/bemenu.c +++ b/client/bemenu.c @@ -16,6 +16,7 @@ static struct client client = { .bottom = false, .grab = false, .wrap = false, + .scrollbar = false, }; static void diff --git a/client/common/common.c b/client/common/common.c index e8ad262..72335e7 100644 --- a/client/common/common.c +++ b/client/common/common.c @@ -67,7 +67,8 @@ usage(FILE *out, const char *name) " -l, --list list items vertically with the given number of lines.\n" " -p, --prompt defines the prompt text to be displayed.\n" " -P, --prefix text to shown before highlighted item.\n" - " -I, --index select item at index automatically.\n\n" + " -I, --index select item at index automatically.\n" + " --scrollbar display scrollbar.\n\n" "Use BEMENU_BACKEND env variable to force backend:\n" " curses ncurses based terminal backend\n" @@ -114,6 +115,7 @@ parse_args(struct client *client, int *argc, char **argv[]) { "prompt", required_argument, 0, 'p' }, { "index", required_argument, 0, 'I' }, { "prefix", required_argument, 0, 'P' }, + { "scrollbar", no_argument, 0, 0x113 }, { "bottom", no_argument, 0, 'b' }, { "grab", no_argument, 0, 'f' }, @@ -170,6 +172,9 @@ parse_args(struct client *client, int *argc, char **argv[]) case 'I': client->selected = strtol(optarg, NULL, 10); break; + case 0x113: + client->scrollbar = true; + break; case 'b': client->bottom = true; @@ -249,6 +254,7 @@ menu_with_options(struct client *client) bm_menu_set_wrap(menu, client->wrap); bm_menu_set_bottom(menu, client->bottom); bm_menu_set_monitor(menu, client->monitor); + bm_menu_set_scrollbar(menu, client->scrollbar); for (uint32_t i = 0; i < BM_COLOR_LAST; ++i) bm_menu_set_color(menu, i, client->colors[i]); diff --git a/client/common/common.h b/client/common/common.h index fab8758..914ddf0 100644 --- a/client/common/common.h +++ b/client/common/common.h @@ -15,6 +15,7 @@ struct client { bool bottom; bool grab; bool wrap; + bool scrollbar; }; void parse_args(struct client *client, int *argc, char **argv[]); -- cgit v1.2.3-70-g09d2