diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-05-31 20:32:02 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-05-31 23:20:54 +0000 |
commit | 93cde4831bca7055c38a1d6246fdcb84df07f7ec (patch) | |
tree | 15bc616a6da2139483d76ebe384d00a636b16441 /client/common/common.c | |
parent | 121367b9406b58c80591a21be3bd6e4771facb5e (diff) | |
download | bemenu-93cde4831bca7055c38a1d6246fdcb84df07f7ec.tar.gz bemenu-93cde4831bca7055c38a1d6246fdcb84df07f7ec.tar.bz2 bemenu-93cde4831bca7055c38a1d6246fdcb84df07f7ec.zip |
bemenu: add --line-height / -H option
Text is displayed vertically centered in a line. If unspecified, or 0,
the previous behaviour of making the height the size of the text, plus
two pixels on either side, is used, so there will be no change in
behaviour if this option is not used.
Fixes https://github.com/Cloudef/bemenu/issues/44.
Diffstat (limited to 'client/common/common.c')
-rw-r--r-- | client/common/common.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/client/common/common.c b/client/common/common.c index a82aedb..9e5c297 100644 --- a/client/common/common.c +++ b/client/common/common.c @@ -86,6 +86,7 @@ usage(FILE *out, const char *name) " -f, --grab show the menu before reading stdin. (wx)\n" " -n, --no-overlap adjust geometry to not overlap with panels. (w)\n" " -m, --monitor index of monitor where menu will appear. (x)\n" + " -H, --line-height defines the height to make each menu line (0 = default height). (wx)\n" " --fn defines the font to be used ('name [size]'). (wx)\n" " --tb defines the title background color. (wx)\n" " --tf defines the title foreground color. (wx)\n" @@ -125,6 +126,7 @@ parse_args(struct client *client, int *argc, char **argv[]) { "grab", no_argument, 0, 'f' }, { "no-overlap", no_argument, 0, 'n' }, { "monitor", required_argument, 0, 'm' }, + { "line-height", required_argument, 0, 'H' }, { "fn", required_argument, 0, 0x101 }, { "tb", required_argument, 0, 0x102 }, { "tf", required_argument, 0, 0x103 }, @@ -148,7 +150,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:P:I:bfm:n", opts, NULL); + int32_t opt = getopt_long(*argc, *argv, "hviwl:I:p:P:I:bfm:H:n", opts, NULL); if (opt < 0) break; @@ -198,6 +200,9 @@ parse_args(struct client *client, int *argc, char **argv[]) client->no_overlap = true; break; + case 'H': + client->line_height = strtol(optarg, NULL, 10); + break; case 0x101: client->font = optarg; break; @@ -262,6 +267,7 @@ menu_with_options(const struct client *client) return NULL; bm_menu_set_font(menu, client->font); + bm_menu_set_line_height(menu, client->line_height); bm_menu_set_title(menu, client->title); bm_menu_set_prefix(menu, client->prefix); bm_menu_set_filter_mode(menu, client->filter_mode); |