Skip to content
Myr

Add `keyboard-focus=exclusive|on-demand` command line and config option

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

authored by bbb651 · committed by bbb651 · parent 33c9b8e · Browse files · 10 files+119 added−32 removed
This commit

State

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

Diff stats

10 files+119 added−32 removed

  • other:+119 added−32 removed

10 files+119 added−32 removed

modified:completions/fish/fuzzel.fish+1 added
61 unmodified lines
62complete -c fuzzel -x -l fuzzy-max-distance -d "maximum allowed levenshtein distance between the search string and a fuzzy match (1)"63complete -c fuzzel -x -l line-height -d "override the line height from font metrics, in points or pixels"64complete -c fuzzel -x -l letter-spacing -d "additional letter spacing, in points or pixels"65complete -c fuzzel -x -l layer -a "top overlay" -d "which layer to render the fuzzel window on (top)"66complete -c fuzzel -x -l keyboard-focus -a "exclusive on-demand" -d "keyboard focus mode (exclusive)"67complete -c fuzzel -x -l render-workers -d "number of render worker threads"68complete -c fuzzel -x -l match-workers -d "number of match worker threads"69complete -c fuzzel -x -l delayed-filter-ms -d "time in milliseconds to delay refiltering when there are lots of matches"70complete -c fuzzel -x -l delayed-filter-limit -d "switch to delayed refiltering when there are more matches than this"
11 unmodified lines
modified:completions/zsh/_fuzzel+1 added
53 unmodified lines
54 '--fuzzy-max-distance[maximum allowed levenshtein distance between the search string and a fuzzy match (1)]:()' \55 '--line-height[override line height from font metrics, in points or pixels]:()' \56 '--letter-spacing[additional letter spacing, in points or pixels]:()' \57 '--layer[which layer to render the fuzzel window on (top)]:layer:(top overlay)' \58 '--keyboard-focus[keyboard focus mode (exclusive)]:keyboard-focus:(exclusive on-demand)' \59 '--render-workers[number of render worker threads]:render-workers:()' \60 '--match-workers[number of match worker threads]:match-workers:()' \61 '--delayed-filter-ms[time in milliseconds to delay refiltering when there are lots of matches]:delayed-filter-ms:()' \62 '--delayed-filter-limit[switch to delayed refiltering when there are more matches than this]:delayed-filter-limit:()' \
29 unmodified lines
modified:doc/fuzzel.1.scd+14 added
309 unmodified lines
310 that means fuzzel may or may not appear on top of a lock screen.311 312 Default: _top_313314*--keyboard-focus*=_exclusive_|_on-demand_315 Keyboard focusing mode, valid modes are *exclusive* and *on-demand*.316 317 *exclusive* locks keyboard focus to fuzzel, receiving all keyboard318 input until closed.319 320 *on-demand* makes fuzzel focus like a regular window, allowing other321 windows to take keyboard focus by e.g. clicking on them.322 By default switching keyboard focus will immediately close fuzzel,323 using *--no-exit-on-keyboard-focus-loss* allows interacting with324 other windows while fuzzel is open.325 326 Default: _exclusive_327328*--no-exit-on-keyboard-focus-loss*329 Do not exit when losing keyboard focus. This can be useful on330 compositors where enabling "focus-follows-mouse" causes fuzzel to331 exit as soon as the mouse is moved over another window. Sway (at
163 unmodified lines
modified:doc/fuzzel.ini.5.scd+14 added
275 unmodified lines
276 that means fuzzel may or may not appear on top of a lock screen.277 278 Default: _overlay_279280*keyboard-focus*281 Keyboard focusing mode, valid modes are *exclusive* and *on-demand*.282 283 *exclusive* locks keyboard focus to fuzzel, receiving all keyboard284 input until closed.285 286 *on-demand* makes fuzzel focus like a regular window, allowing other287 windows to take keyboard focus by e.g. clicking on them.288 By default switching keyboard focus will immediately close fuzzel,289 using *exit-on-keyboard-focus-loss=no* allows interacting with290 other windows while fuzzel is open.291 292 Default: _exclusive_293294*exit-on-keyboard-focus-loss*295 Boolean. If true, exit when the fuzzel window loses keyboard focus.296 297 Setting this to false can be useful on compositors where enabling
266 unmodified lines
modified:CHANGELOG.md+2 added
32 unmodified lines
3334* Nanosvg updated to ea6a6aca009422bba0dbad4c80df6e6ba0c8218335* `--with-nth=N` command line option ([#438][438]).36* `--accept-nth=N` command line option ([#493][493]).37* `keyboard-focus=exclusive|on-demand` command line and config option ([#495][495]).3839[438]: https://codeberg.org/dnkl/fuzzel/issues/43840[493]: https://codeberg.org/dnkl/fuzzel/pulls/49341[495]: https://codeberg.org/dnkl/fuzzel/pulls/495424344### Changed45
873 unmodified lines
modified:config.c+13 added
989 unmodified lines
990 LOG_CONTEXTUAL_ERR("not one of 'top', 'overay'");991 return false;992 }993994 else if (strcmp(key, "keyboard-focus") == 0) {995 if (strcasecmp(value, "exclusive") == 0) {996 conf->keyboard_focus = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE;997 return true;998 } else if (strcasecmp(value, "on-demand") == 0) {999 conf->keyboard_focus = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND;1000 return true;1001 }1002 LOG_CONTEXTUAL_ERR("not one of 'exclusive', 'on-demand'");1003 return false;1004 }10051006 else if (strcmp(key, "exit-on-keyboard-focus-loss") == 0)1007 return value_to_bool(ctx, &conf->exit_on_kb_focus_loss);10081009 else if (strcmp(key, "cache") == 0)
648 unmodified lines
1658 .image_size_ratio = 0.5,1659 .line_height = {-1, 0.0},1660 .letter_spacing = {0},1661 .layer = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY,1662 .keyboard_focus = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE,1663 .exit_on_kb_focus_loss = true,1664 .list_executables_in_path = false,1665 .cache_path = NULL,1666 };
79 unmodified lines
modified:config.h+1 added
194 unmodified lines
195 struct pt_or_px line_height;196 struct pt_or_px letter_spacing;197198 enum zwlr_layer_shell_v1_layer layer;199 enum zwlr_layer_surface_v1_keyboard_interactivity keyboard_focus;200 bool exit_on_kb_focus_loss;201202 bool list_executables_in_path;203 char *cache_path;
10 unmodified lines
modified:fuzzel.ini+1 added
34 unmodified lines
35# line-height=<use font metrics>36# letter-spacing=03738# layer=overlay39# keyboard-focus=on-demand40# exit-on-keyboard-focus-loss=yes4142# cache=<not set>43
74 unmodified lines
modified:main.c+51 added-30 removed
387 unmodified lines
388 " --line-height=HEIGHT override line height from font metrics\n"389 " --letter-spacing=AMOUNT additional letter spacing\n"390 " --layer=top|overlay which layer to render the fuzzel window on\n"391 " (top)\n"392 " --keyboard-focus=exclusive|on-demand keyboard focus mode (exclusive)\n"393 " --no-exit-on-keyboard-focus-loss do not exit when losing keyboard focus\n"394 " --launch-prefix=COMMAND prefix to add before argv of executed program\n"395 " --list-executables-in-path include executables from PATH in the list\n"396 " --render-workers=N number of threads to use for rendering\n"
319 unmodified lines
716 #define OPT_PASSWORD 267717 #define OPT_CONFIG 268718 #define OPT_LAYER 269719 #define OPT_ICON_THEME 270719 #define OPT_NO_EXIT_ON_KB_LOSS 271720 #define OPT_TABS 272721 #define OPT_DMENU_NULL 273722 #define OPT_FILTER_DESKTOP 274723 #define OPT_CHECK_CONFIG 275724 #define OPT_SELECT 276725 #define OPT_SELECT_INDEX 277726 #define OPT_LIST_EXECS_IN_PATH 278727 #define OPT_X_MARGIN 279728 #define OPT_Y_MARGIN 280729 #define OPT_CACHE 281730 #define OPT_RENDER_WORKERS 282731 #define OPT_PROMPT_COLOR 283732 #define OPT_INPUT_COLOR 284733 #define OPT_PROMPT_ONLY 285734 #define OPT_COUNTER_COLOR 286735 #define OPT_USE_BOLD 287736 #define OPT_MATCH_WORKERS 288737 #define OPT_NO_SORT 289738 #define OPT_DELAYED_FILTER_MS 290739 #define OPT_DELAYED_FILTER_LIMIT 291740 #define OPT_PLACEHOLDER 292741 #define OPT_PLACEHOLDER_COLOR 293742 #define OPT_SEARCH_TEXT 294743 #define OPT_COUNTER 295744 #define OPT_HIDE_WHEN_PROMPT_EMPTY 296745 #define OPT_DMENU_WITH_NTH 297746 #define OPT_DMENU_ACCEPT_NTH 298720 #define OPT_KEYBOARD_FOCUS 271721 #define OPT_NO_EXIT_ON_KB_LOSS 272722 #define OPT_TABS 273723 #define OPT_DMENU_NULL 274724 #define OPT_FILTER_DESKTOP 275725 #define OPT_CHECK_CONFIG 276726 #define OPT_SELECT 277727 #define OPT_SELECT_INDEX 278728 #define OPT_LIST_EXECS_IN_PATH 279729 #define OPT_X_MARGIN 280730 #define OPT_Y_MARGIN 281731 #define OPT_CACHE 282732 #define OPT_RENDER_WORKERS 283733 #define OPT_PROMPT_COLOR 284734 #define OPT_INPUT_COLOR 285735 #define OPT_PROMPT_ONLY 286736 #define OPT_COUNTER_COLOR 287737 #define OPT_USE_BOLD 288738 #define OPT_MATCH_WORKERS 289739 #define OPT_NO_SORT 290740 #define OPT_DELAYED_FILTER_MS 291741 #define OPT_DELAYED_FILTER_LIMIT 292742 #define OPT_PLACEHOLDER 293743 #define OPT_PLACEHOLDER_COLOR 294744 #define OPT_SEARCH_TEXT 295745 #define OPT_COUNTER 296746 #define OPT_HIDE_WHEN_PROMPT_EMPTY 297747 #define OPT_DMENU_WITH_NTH 298748 #define OPT_DMENU_ACCEPT_NTH 299749750 static const struct option longopts[] = {751 {"config", required_argument, 0, OPT_CONFIG},752 {"check-config", no_argument, 0, OPT_CHECK_CONFIG},
45 unmodified lines
798 {"line-height", required_argument, 0, 'H'},799 {"letter-spacing", required_argument, 0, OPT_LETTER_SPACING},800 {"launch-prefix", required_argument, 0, OPT_LAUNCH_PREFIX},801 {"layer", required_argument, 0, OPT_LAYER},802 {"keyboard-focus", required_argument, 0, OPT_KEYBOARD_FOCUS},800 {"no-exit-on-keyboard-focus-loss", no_argument, 0, OPT_NO_EXIT_ON_KB_LOSS},801 {"list-executables-in-path", no_argument, 0, OPT_LIST_EXECS_IN_PATH},803 {"no-exit-on-keyboard-focus-loss", no_argument, 0, OPT_NO_EXIT_ON_KB_LOSS},804 {"list-executables-in-path", no_argument, 0, OPT_LIST_EXECS_IN_PATH},805 {"render-workers", required_argument, 0, OPT_RENDER_WORKERS},806 {"match-workers", required_argument, 0, OPT_MATCH_WORKERS},807 {"no-sort", no_argument, 0, OPT_NO_SORT},808 {"counter", no_argument, 0, OPT_COUNTER},
67 unmodified lines
876 bool dmenu_delim_set:1;877 bool dmenu_with_nth_set:1;878 bool dmenu_accept_nth_set:1;879 bool layer_set:1;880 bool keyboard_focus_set:1;881 bool no_exit_on_keyboard_focus_loss_set:1;882 bool render_workers_set:1;883 bool match_workers_set:1;884 bool prompt_only_set:1;
637 unmodified lines
1522 }1523 cmdline_overrides.layer_set = true;1524 break;15251526 case OPT_KEYBOARD_FOCUS:1527 if (strcasecmp(optarg, "exclusive") == 0)1528 cmdline_overrides.conf.keyboard_focus = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE;1529 else if (strcasecmp(optarg, "on-demand") == 0)1530 cmdline_overrides.conf.keyboard_focus = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND;1531 else {1532 fprintf(1533 stderr,1534 "%s: invalid keyboard-focus. Must be one of 'exclusive', 'on-demand'\n",1535 optarg);1536 return EXIT_FAILURE;1537 }1538 cmdline_overrides.keyboard_focus_set = true;1539 break;15401541 case OPT_NO_EXIT_ON_KB_LOSS:1542 cmdline_overrides.conf.exit_on_kb_focus_loss = false;1543 cmdline_overrides.no_exit_on_keyboard_focus_loss_set = true;1544 break;
279 unmodified lines
1824 if (cmdline_overrides.letter_spacing_set)1825 conf.letter_spacing = cmdline_overrides.conf.letter_spacing;1826 if (cmdline_overrides.layer_set)1827 conf.layer = cmdline_overrides.conf.layer;1828 if (cmdline_overrides.keyboard_focus_set)1829 conf.keyboard_focus = cmdline_overrides.conf.keyboard_focus;1830 if (cmdline_overrides.no_exit_on_keyboard_focus_loss_set)1831 conf.exit_on_kb_focus_loss = cmdline_overrides.conf.exit_on_kb_focus_loss;1832 if (cmdline_overrides.dmenu_enabled_set)1833 conf.dmenu.enabled = cmdline_overrides.conf.dmenu.enabled;
237 unmodified lines
modified:wayland.c+21 added-2 removed
158 unmodified lines
159160 struct wl_surface *surface;161 struct zwlr_layer_shell_v1 *layer_shell;162 struct zwlr_layer_surface_v1 *layer_surface;163 bool has_zwlr_layer_shell_kb_inter_on_demand;164165 struct wp_viewport *viewport;166 struct wp_fractional_scale_v1 *fractional_scale;167168 struct wl_shm *shm;
1550 unmodified lines
1719 const uint32_t required = 1;1720 if (!verify_iface_version(interface, version, required))1721 return;17221723#if defined(ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND_SINCE_VERSION)1724 const uint32_t preferred = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND_SINCE_VERSION;1725 wayl->has_zwlr_layer_shell_kb_inter_on_demand =1726 version >= ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND_SINCE_VERSION;1727#else1728 const uint32_t preferred = required;1729#endif17301731 wayl->layer_shell = wl_registry_bind(1722 wayl->registry, name, &zwlr_layer_shell_v1_interface, required);1732 wayl->registry, name, &zwlr_layer_shell_v1_interface, min(version, preferred));17331734 if (wayl->conf->keyboard_focus == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND &&1735 !wayl->has_zwlr_layer_shell_kb_inter_on_demand) {1736 LOG_WARN("keyboard-focus=on-demand requires zwlr_layer_shell_v1 version: %d, found version: %d",1737 ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND_SINCE_VERSION, version);1738 }1739 }17401741 else if (strcmp(interface, wl_seat_interface.name) == 0) {1742 const uint32_t required = 4;
654 unmodified lines
2397 wp_fractional_scale_v1_add_listener(2398 wayl->fractional_scale, &fractional_scale_listener, wayl);2399 }24002385 zwlr_layer_surface_v1_set_keyboard_interactivity(wayl->layer_surface, 1);2401 zwlr_layer_surface_v1_set_keyboard_interactivity(wayl->layer_surface,2402 wayl->has_zwlr_layer_shell_kb_inter_on_demand2403 ? wayl->conf->keyboard_focus2404 : ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE);24052406 zwlr_layer_surface_v1_add_listener(2407 wayl->layer_surface, &layer_surface_listener, wayl);2408
115 unmodified lines