From b70772372ef51a64dece064aaa0e25e0a83354fd Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Fri, 24 Jun 2022 16:48:15 +0100 Subject: Horizontal mode fixes. Implement horizontal mode for Pango, and add min-input-width option. --- src/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 95c7b33..cf0e3a8 100644 --- a/src/main.c +++ b/src/main.c @@ -195,12 +195,12 @@ static void wl_keyboard_key( return; } - if (sym == XKB_KEY_Up) { + if (sym == XKB_KEY_Up || sym == XKB_KEY_Left) { uint32_t nsel = MAX(MIN(tofi->window.entry.num_results, tofi->window.entry.results.count), 1); tofi->window.entry.selection += nsel; tofi->window.entry.selection--; tofi->window.entry.selection %= nsel; - } else if (sym == XKB_KEY_Down) { + } else if (sym == XKB_KEY_Down || sym == XKB_KEY_Right) { uint32_t nsel = MAX(MIN(tofi->window.entry.num_results, tofi->window.entry.results.count), 1); tofi->window.entry.selection++; tofi->window.entry.selection %= nsel; @@ -575,6 +575,7 @@ static void usage() " --num-results Maximum number of results to display.\n" " --selection-color Color of selected result.\n" " --result-padding Spacing between results. Can be negative.\n" +" --min-input-width Minimum width of input in horizontal mode.\n" " --width Width of the window.\n" " --height Height of the window.\n" " --anchor Location on screen to anchor window.\n" @@ -583,6 +584,7 @@ static void usage() " --margin-left Offset from left of screen.\n" " --margin-right Offset from right of screen.\n" " --hide-cursor Hide the cursor.\n" +" --horizontal List results horizontally.\n" " --history Sort results by number of usages.\n" ); } @@ -606,6 +608,7 @@ static void parse_args(struct tofi *tofi, int argc, char *argv[]) {"outline-color", required_argument, NULL, 0}, {"prompt-text", required_argument, NULL, 0}, {"result-padding", required_argument, NULL, 0}, + {"min-input-width", required_argument, NULL, 0}, {"border-width", required_argument, NULL, 0}, {"border-color", required_argument, NULL, 0}, {"text-color", required_argument, NULL, 0}, @@ -615,7 +618,7 @@ static void parse_args(struct tofi *tofi, int argc, char *argv[]) {"margin-bottom", required_argument, NULL, 0}, {"margin-left", required_argument, NULL, 0}, {"margin-right", required_argument, NULL, 0}, - {"layout-horizontal", required_argument, NULL, 0}, + {"horizontal", required_argument, NULL, 0}, {"hide-cursor", required_argument, NULL, 0}, {"history", required_argument, NULL, 0}, {NULL, 0, NULL, 0} -- cgit v1.2.3