summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2015-01-17 18:53:29 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2015-01-17 18:53:29 +0200
commit074b2d1b5894f12fae78a569ea507612616663ff (patch)
tree505af8b2e0a82993d2d070afcf42fe303dbf1302 /client
parentb32b8db5236f86007cd37aecbcc64060b2038fc2 (diff)
downloadbemenu-074b2d1b5894f12fae78a569ea507612616663ff.tar.gz
bemenu-074b2d1b5894f12fae78a569ea507612616663ff.tar.bz2
bemenu-074b2d1b5894f12fae78a569ea507612616663ff.zip
Remove --backend and --prioritory options, change prioritory -> priorty
and provide BEMENU_BACKEND env variable. Change API to reflect this change. There is no reliable way to detect when running on terminal (especially when stdin is a pipe), so we need to make curses backend explicit with BEMENU_BACKEND=curses or bm_menu_new("curses"), otherwise GUI backend will be choosed automatically.
Diffstat (limited to 'client')
-rw-r--r--client/bemenu-run.c1
-rw-r--r--client/bemenu.c1
-rw-r--r--client/common/common.c50
-rw-r--r--client/common/common.h1
4 files changed, 23 insertions, 30 deletions
diff --git a/client/bemenu-run.c b/client/bemenu-run.c
index b68e715..0efc32a 100644
--- a/client/bemenu-run.c
+++ b/client/bemenu-run.c
@@ -8,7 +8,6 @@
#include "../lib/3rdparty/tinydir.h"
static struct client client = {
- .prioritory = BM_PRIO_ANY,
.filter_mode = BM_FILTER_MODE_DMENU,
.wrap = 0,
.lines = 0,
diff --git a/client/bemenu.c b/client/bemenu.c
index 338617c..e441f3d 100644
--- a/client/bemenu.c
+++ b/client/bemenu.c
@@ -5,7 +5,6 @@
#include "common.h"
static struct client client = {
- .prioritory = BM_PRIO_ANY,
.filter_mode = BM_FILTER_MODE_DMENU,
.wrap = 0,
.lines = 0,
diff --git a/client/common/common.c b/client/common/common.c
index 6bb2ec7..52f71bc 100644
--- a/client/common/common.c
+++ b/client/common/common.c
@@ -67,9 +67,14 @@ 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"
- " --backend options: curses, wayland, x11\n"
- " --prioritory options: terminal, gui\n\n"
+ " -I, --index select item at index automatically.\n\n"
+
+ "Use BEMENU_BACKEND env variable to force backend:\n"
+ " curses ncurses based terminal backend\n"
+ " wayland wayland backend\n"
+ " x11 x11 backend\n\n"
+
+ "If BEMENU_BACKEND is empty, one of the GUI backends is selected automatically.\n\n"
"Backend specific options\n"
" c = ncurses, w == wayland, x == x11\n"
@@ -109,26 +114,24 @@ parse_args(struct client *client, int *argc, char **argv[])
{ "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 },
{ "bottom", no_argument, 0, 'b' },
{ "grab", no_argument, 0, 'f' },
{ "monitor", required_argument, 0, 'm' },
- { "fn", required_argument, 0, 0x102 },
- { "bg", required_argument, 0, 0x103 },
- { "tb", required_argument, 0, 0x104 },
- { "tf", required_argument, 0, 0x105 },
- { "fb", required_argument, 0, 0x106 },
- { "ff", required_argument, 0, 0x107 },
- { "nb", required_argument, 0, 0x108 },
- { "nf", required_argument, 0, 0x109 },
- { "hb", required_argument, 0, 0x110 },
- { "hf", required_argument, 0, 0x111 },
- { "sb", required_argument, 0, 0x112 },
- { "sf", required_argument, 0, 0x113 },
-
- { "disco", no_argument, 0, 0x114 },
+ { "fn", required_argument, 0, 0x100 },
+ { "bg", required_argument, 0, 0x101 },
+ { "tb", required_argument, 0, 0x102 },
+ { "tf", required_argument, 0, 0x103 },
+ { "fb", required_argument, 0, 0x104 },
+ { "ff", required_argument, 0, 0x105 },
+ { "nb", required_argument, 0, 0x106 },
+ { "nf", required_argument, 0, 0x107 },
+ { "hb", required_argument, 0, 0x108 },
+ { "hf", required_argument, 0, 0x109 },
+ { "sb", required_argument, 0, 0x110 },
+ { "sf", required_argument, 0, 0x111 },
+
+ { "disco", no_argument, 0, 0x112 },
{ 0, 0, 0, 0 }
};
@@ -172,13 +175,6 @@ parse_args(struct client *client, int *argc, char **argv[])
client->renderer = optarg;
break;
- case 0x101:
- if (!strcmp(optarg, "terminal"))
- client->prioritory = BM_PRIO_TERMINAL;
- else if (!strcmp(optarg, "gui"))
- client->prioritory = BM_PRIO_GUI;
- break;
-
case 'b':
client->bottom = 1;
break;
@@ -246,7 +242,7 @@ struct bm_menu*
menu_with_options(struct client *client)
{
struct bm_menu *menu;
- if (!(menu = bm_menu_new(client->renderer, client->prioritory)))
+ if (!(menu = bm_menu_new(NULL)))
return NULL;
bm_menu_set_font(menu, client->font);
diff --git a/client/common/common.h b/client/common/common.h
index bae498f..284b962 100644
--- a/client/common/common.h
+++ b/client/common/common.h
@@ -4,7 +4,6 @@
#include <bemenu.h>
struct client {
- enum bm_prioritory prioritory;
enum bm_filter_mode filter_mode;
int32_t wrap;
uint32_t lines;