summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/bemenu-run.c1
-rw-r--r--client/bemenu.c1
-rw-r--r--client/common/common.c8
-rw-r--r--client/common/common.h1
4 files changed, 10 insertions, 1 deletions
diff --git a/client/bemenu-run.c b/client/bemenu-run.c
index 4ac1175..9ef7b66 100644
--- a/client/bemenu-run.c
+++ b/client/bemenu-run.c
@@ -15,6 +15,7 @@ static struct client client = {
.lines = 0,
.colors = {0},
.title = "bemenu",
+ .prefix = NULL,
.renderer = NULL,
.font = NULL,
.font_size = 0,
diff --git a/client/bemenu.c b/client/bemenu.c
index 96ad72e..b344443 100644
--- a/client/bemenu.c
+++ b/client/bemenu.c
@@ -11,6 +11,7 @@ static struct client client = {
.lines = 0,
.colors = {0},
.title = "bemenu",
+ .prefix = NULL,
.renderer = NULL,
.font = NULL,
.font_size = 0,
diff --git a/client/common/common.c b/client/common/common.c
index e34a34f..8677d1f 100644
--- a/client/common/common.c
+++ b/client/common/common.c
@@ -67,6 +67,7 @@ usage(FILE *out, const char *name)
" -w, --wrap wraps cursor selection.\n"
" -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"
" --backend options: curses, wayland\n"
" --prioritory options: terminal, gui\n\n"
@@ -108,6 +109,7 @@ parse_args(struct client *client, int *argc, char **argv[])
{ "list", required_argument, 0, 'l' },
{ "prompt", required_argument, 0, 'p' },
{ "index", required_argument, 0, 'I' },
+ { "prefix", required_argument, 0, 'P' },
{ "backend", required_argument, 0, 0x100 },
{ "prioritory", required_argument, 0, 0x101 },
@@ -136,7 +138,7 @@ parse_args(struct client *client, int *argc, char **argv[])
* or parse them before running getopt.. */
for (;;) {
- int32_t opt = getopt_long(*argc, *argv, "hviwl:I:p:I:bfm:", opts, NULL);
+ int32_t opt = getopt_long(*argc, *argv, "hviwl:I:p:P:I:bfm:", opts, NULL);
if (opt < 0)
break;
@@ -160,6 +162,9 @@ parse_args(struct client *client, int *argc, char **argv[])
case 'p':
client->title = optarg;
break;
+ case 'P':
+ client->prefix = optarg;
+ break;
case 'I':
client->selected = strtol(optarg, NULL, 10);
break;
@@ -248,6 +253,7 @@ menu_with_options(struct client *client)
bm_menu_set_font(menu, client->font, client->font_size);
bm_menu_set_title(menu, client->title);
+ bm_menu_set_prefix(menu, client->prefix);
bm_menu_set_filter_mode(menu, client->filter_mode);
bm_menu_set_lines(menu, client->lines);
bm_menu_set_wrap(menu, client->wrap);
diff --git a/client/common/common.h b/client/common/common.h
index b87b974..e710236 100644
--- a/client/common/common.h
+++ b/client/common/common.h
@@ -10,6 +10,7 @@ struct client {
uint32_t lines;
const char *colors[BM_COLOR_LAST];
const char *title;
+ const char *prefix;
const char *renderer;
char *font;
uint32_t font_size;