Skip to content
Myr

✨ New Feature: Hide Input Line (#597)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Hiding the prompt/input line may be of interest for a more minimal design, and also makes Fuzzel for building small menus or touch-based menus where a filtering feature is not necessary. To select items with the prompt hidden, arrow keys can be used or... as a hidden feature you can still type input as before, but it won't be visible. Fixes #430 Replaces #596 ## Questions * Is --hide-prompt clear enough? Perhaps that sounds like it refers to just the prompt and not the whole line. Alternate suggestion: `--hide-input-line`. Including "line" in the name make sit clearer that the whole line is being hidden, not just the prompt part. If this feature is approved, there's still a bit more clean-up work to do with docs/completions/changelog. ## Screenshot ![image](/attachments/d09350ee-49d5-4346-8861-35174a9228f9) That was made with: ``` echo -e '⏻Power Off\n󰜉 Restart' | ./pkg/fuzzel/usr/bin/fuzzel --hide-prompt --minimal-lines --dmenu --width 10 ``` The version includes the UX idea of still allowing input, although it's now hidden. That means in addition to selecting with the arrow keys or via touch, you can still filter as before! If you normally use Fuzzel by typing a few characters and hitting enter, this offers an option for an even more minimal aesthetic.

authored by Mark Stosberg · committed by markstos · parent 0d0e65f · Browse files · 8 files+50 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Reviewed-on: https://codeberg.org/dnkl/fuzzel/pulls/597
  • Reviewed-by: dnkl <dnkl@noreply.codeberg.org>
  • Co-authored-by: Mark Stosberg <mark@stosberg.com>
  • Co-committed-by: Mark Stosberg <mark@stosberg.com>

Diff stats

8 files+50 added−9 removed

  • other:+50 added−9 removed

8 files+50 added−9 removed

modified:doc/fuzzel.1.scd+7 added-1 removed
132 unmodified lines
133 - sets *--lines* to 0134 135 In non-dmenu mode it behaves exactly like *--prompt*.136137*--hide-prompt*138 Hide the prompt line, making the window smaller. Input is still139 accepted, but the prompt line is not displayed. This option140 cannot be used at the same time with *--prompt-only*.141142*--placeholder*=_TEXT_143 Text to display as placeholder in the input box. Default: empty.144145*--search*=_TEXT_
23 unmodified lines
169 170 - *filename*: the .desktop file's filename171 - *name*: the application's name (title)172 - *generic*: the application's generic name168 - *exec*: the applications's executable, as specified in the desktop file. Note: may include command line options as well.173 - *exec*: the applications's executable, as specified in the desktop174 file. Note: may include command line options as well.175 - *keywords*: the application's keywords176 - *categories*: the application's categories177 - *comment*: the application's comment178
407 unmodified lines
modified:doc/fuzzel.ini.5.scd+5 added
281 unmodified lines
282283*lines*284 Number of matches to show. Default: _15_.285286*hide-prompt*287 Boolean. When set, hides the prompt line, making the window smaller.288 Input is still accepted though the prompt line is not displayed.289 Cannot be used with *prompt-only*. Default: _no_.290291*minimal-lines*292 Boolean. Adjust the number of lines to display to the minimum of293 _lines_ and the number of input lines. Only effective in dmenu294 mode. This allows fuzzel to size itself to the actual number of
406 unmodified lines
modified:CHANGELOG.md+4 added
50 unmodified lines
51* `{cmd}` placeholder support in the `terminal` option. When `{cmd}` is52 present in the terminal command string, it will be replaced with the53 application command instead of appending the command at the end. Useful54 for setting the title or app_id. ([#600][600])55* `--hide-prompt` command line option to hide the prompt line, reducing56 window size while still accepting input. This cannot be used57 simultaneously with `--prompt-only`.i ([#597][597])5859[504]: https://codeberg.org/dnkl/fuzzel/pulls/50460[512]: https://codeberg.org/dnkl/fuzzel/pulls/51261[546]: https://codeberg.org/dnkl/fuzzel/issues/54662[553]: https://codeberg.org/dnkl/fuzzel/issues/55363[144]: https://codeberg.org/dnkl/fuzzel/issues/14464[594]: https://codeberg.org/dnkl/fuzzel/issues/59465[597]: https://codeberg.org/dnkl/fuzzel/issues/59766[600]: https://codeberg.org/dnkl/fuzzel/issues/6006768### Changed69
958 unmodified lines
modified:config.c+3 added
951 unmodified lines
952953 else if (strcmp(key, "minimal-lines") == 0)954 return value_to_bool(ctx, &conf->minimal_lines);955956 else if (strcmp(key, "hide-prompt") == 0)957 return value_to_bool(ctx, &conf->hide_prompt);958959 else if (strcmp(key, "width") == 0)960 return value_to_uint32(ctx, 10, &conf->chars);961962 else if (strcmp(key, "tabs") == 0)
816 unmodified lines
modified:config.h+1 added
140 unmodified lines
141 bool icons_enabled;142 char *icon_theme;143144 bool hide_when_prompt_empty;145 bool hide_prompt;146147 bool actions_enabled;148149 struct config_key_binding_list key_bindings;
85 unmodified lines
modified:main.c+20 added-2 removed
374 unmodified lines
375 " -l,--lines number of matches to show\n"376 " --minimal-lines adjust the number of lines to the\n"377 " minimum of --lines and the number\n"378 " of input lines (dmenu mode only)\n"379 " --hide-prompt hide the prompt line, making the window\n"380 " smaller (input still accepted)\n"381 " -w,--width window width, in characters (margins and\n"382 " borders not included)\n"383 " --tabs=INT number of spaces a tab is expanded to (8)\n"384 " -x,--horizontal-pad=PAD horizontal padding, in pixels (40)\n"
451 unmodified lines
836 #define OPT_GAMMA_CORRECT 300837 #define OPT_PRINT_TIMINGS 301838 #define OPT_SCALING_FILTER 302839 #define OPT_MINIMAL_LINES 303840 #define OPT_HIDE_PROMPT 304841842 static const struct option longopts[] = {843 {"config", required_argument, 0, OPT_CONFIG},844 {"check-config", no_argument, 0, OPT_CHECK_CONFIG},
15 unmodified lines
860 {"select", required_argument, 0, OPT_SELECT},861 {"select-index", required_argument, 0, OPT_SELECT_INDEX},862 {"lines", required_argument, 0, 'l'},863 {"minimal-lines", no_argument, 0, OPT_MINIMAL_LINES},864 {"hide-prompt", no_argument, 0, OPT_HIDE_PROMPT},865 {"width", required_argument, 0, 'w'},866 {"tabs", required_argument, 0, OPT_TABS},867 {"horizontal-pad", required_argument, 0, 'x'},868 {"vertical-pad", required_argument, 0, 'y'},
75 unmodified lines
944 bool x_margin_set : 1;945 bool y_margin_set : 1;946 bool lines_set:1;947 bool minimal_lines_set:1;948 bool hide_prompt_set:1;949 bool chars_set:1;950 bool tabs_set:1;951 bool pad_x_set:1;952 bool pad_y_set:1;
280 unmodified lines
1233 cmdline_overrides.conf.minimal_lines = true;1234 cmdline_overrides.minimal_lines_set = true;1235 break;12361237 case OPT_HIDE_PROMPT:1238 cmdline_overrides.conf.hide_prompt = true;1239 cmdline_overrides.hide_prompt_set = true;1240 break;12411242 case 'w':1243 if (sscanf(optarg, "%u", &cmdline_overrides.conf.chars) != 1) {1244 fprintf(stderr, "%s: invalid width\n", optarg);1245 return EXIT_FAILURE;
599 unmodified lines
18451846 int ret = EXIT_FAILURE;18471848 if (select != NULL && select_idx) {1839 LOG_ERRNO("--select and --select-index cannot be used at the same time");1840 return ret;1849 LOG_ERRNO("--select and --select-index cannot be used at the same time");1850 return ret;1851 }18521853 if (cmdline_overrides.prompt_only_set && cmdline_overrides.conf.hide_prompt) {1854 LOG_ERRNO("--prompt-only and --hide-prompt cannot be used at the same time");1855 config_free(&cmdline_overrides.conf);1856 return ret;1857 }18581859 struct config conf = {0};1860 bool conf_successful = config_load(&conf, config_path, NULL, check_config);1861 if (!conf_successful) {1862 config_free(&conf);
66 unmodified lines
1929 if (cmdline_overrides.icons_disabled_set)1930 conf.icons_enabled = cmdline_overrides.conf.icons_enabled;1931 if (cmdline_overrides.hide_when_prompt_empty_set)1932 conf.hide_when_prompt_empty = cmdline_overrides.conf.hide_when_prompt_empty;1933 if (cmdline_overrides.hide_prompt_set)1934 conf.hide_prompt = cmdline_overrides.conf.hide_prompt;1935 if (cmdline_overrides.anchor_set)1936 conf.anchor = cmdline_overrides.conf.anchor;1937 if (cmdline_overrides.x_margin_set)1938 conf.margin.x = cmdline_overrides.conf.margin.x;
315 unmodified lines
modified:render.c+7 added-5 removed
1153 unmodified lines
1154first_row_y(const struct render *render)1155{1156 return (render->border_size +1157 render->y_margin +1158 render->row_height +1159 render->inner_pad);1158 (render->conf->hide_prompt ? 0 : render->row_height) +1159 (render->conf->hide_prompt ? 0 : render->inner_pad));1160}11611162static void1163render_match_entry_background(const struct render *render,
403 unmodified lines
15671568 const unsigned height =1569 border_size + /* Top border */1570 y_margin +1571 row_height + /* The prompt */1572 inner_pad + /* Padding between prompt and matches */1571 (render->conf->hide_prompt ? 0 : row_height) + /* The prompt (hidden if hide_prompt) */1572 (render->conf->hide_prompt ? 0 : inner_pad) + /* Padding between prompt and matches (only if prompt shown) */1573 render->conf->lines * row_height + /* Matches */1574 y_margin +1575 border_size; /* Bottom border */1576
107 unmodified lines
1684 const int y_margin = render->y_margin;1685 const int inner_pad = render->inner_pad;1686 const int border_size = render->border_size;1687 const int row_height = render->row_height;1688 const int first_row = 1 * border_size + y_margin + row_height + inner_pad;1688 const int first_row = 1 * border_size + y_margin +1689 (render->conf->hide_prompt ? 0 : row_height) +1690 (render->conf->hide_prompt ? 0 : inner_pad);1691 const size_t match_count = matches_get_count(matches);1692 const size_t last_row = first_row + match_count * row_height;16931694 y = floor(scale * y);
18 unmodified lines
modified:wayland.c+3 added-1 removed
2395 unmodified lines
2396 render_background(wayl->render, buf);23972398 /* Window content */2399 matches_lock(wayl->matches);2400 if (!wayl->conf->hide_prompt) {2400 render_prompt(wayl->render, buf, wayl->prompt, wayl->matches);2401 render_prompt(wayl->render, buf, wayl->prompt, wayl->matches);2402 }2403 if (wayl->hide_when_prompt_empty) {2404 if (prompt_text(wayl->prompt)[0] != '\0') {2405 wayl->hide_when_prompt_empty = false;2406 } else {
576 unmodified lines