Skip to content
Myr

config: add 'cache' option

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

This allows users to define a default cache location in fuzzel.ini. It's mostly useful to disable caching, by setting it to /dev/null. Closes #219

authored by Daniel Eklöf · committed by Daniel Eklöf · parent 04f9729 · Browse files · 6 files+26 added−9 removed
This commit

State

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

Diff stats

6 files+26 added−9 removed

  • other:+26 added−9 removed

6 files+26 added−9 removed

modified:doc/fuzzel.ini.5.scd+5 added
290 unmodified lines
291 When there are more matches than this, switch from immediate292 refiltering to delayed refiltering (see293 *delayed-filter-ms*). Default: _20000_.294295*cache*296 Specify the default cache location. If unset,297 *$XDG_CACHE_HOME/fuzzel* will be used. Set to */dev/null* to298 disable caching. Default: _not set_.299300# SECTION: colors301302All color values are in RGBA.303
216 unmodified lines
modified:CHANGELOG.md+3 added-2 removed
43 unmodified lines
44 (i.e. use the bundled version).45* Mouse support. Left click selects/launches, right click quits46 fuzzel, wheel scrolls (a page at at time). This is, for the time47 being, not configurable ([#131][131])48* `--cache=PATH` command line option, allowing a custom cache location49 to be used ([#189][189], [#219][219]).48* `--cache=PATH` command line option, and `cache` option to49 `fuzzel.ini`, allowing a custom cache location to be used50 ([#189][189], [#219][219]).51* `expunge` key binding, to remove an entry from the cache. Mapped to52 shift+delete by default.53* `--prompt-color` and `colors.prompt`, controlling the54 text/foreground color of the prompt ([#365][365]).
740 unmodified lines
modified:config.c+6 added-1 removed
944 unmodified lines
945 return true;946 }947 else if (strcmp(key, "x-margin") == 0)948 return value_to_uint32(ctx, 10, &conf->margin.x);949 949950 else if (strcmp(key, "y-margin") == 0)951 return value_to_uint32(ctx, 10, &conf->margin.y);952953 else if (strcmp(key, "lines") == 0)
49 unmodified lines
10031004 else if (strcmp(key, "exit-on-keyboard-focus-loss") == 0)1005 return value_to_bool(ctx, &conf->exit_on_kb_focus_loss);10061007 else if (strcmp(key, "cache") == 0)1008 return value_to_str(ctx, &conf->cache_path);10091010 else1011 LOG_CONTEXTUAL_ERR("not a valid option: %s", key);10121013 return false;
644 unmodified lines
1658 .letter_spacing = {0},1659 .layer = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY,1660 .exit_on_kb_focus_loss = true,1661 .list_executables_in_path = false,1662 .cache_path = NULL,1663 };16641665 add_default_key_bindings(conf);1666
61 unmodified lines
1728 free(conf->terminal);1729 free(conf->launch_prefix);1730 free(conf->font);1731 free(conf->icon_theme);1732 free(conf->cache_path);1733 free_key_binding_list(&conf->key_bindings);1734}17351736struct rgba
9 unmodified lines
modified:config.h+1 added
192 unmodified lines
193 enum zwlr_layer_shell_v1_layer layer;194 bool exit_on_kb_focus_loss;195196 bool list_executables_in_path;197 char *cache_path;198};199200typedef tll(char *) config_override_t;201
6 unmodified lines
modified:fuzzel.ini+4 added-2 removed
31 unmodified lines
3233# line-height=<use font metrics>34# letter-spacing=03536# layer = overlay37# exit-on-keyboard-focus-loss = yes36# layer=overlay37# exit-on-keyboard-focus-loss=yes3839# cache=<not set>4041# render-workers=<number of logical CPUs>42# match-workers=<number of logical CPUs>4344[colors]
68 unmodified lines
modified:main.c+7 added-4 removed
795 unmodified lines
796 };797798 bool check_config = false;799 const char *config_path = NULL;800 const char *cache_path = NULL;800 enum log_class log_level = LOG_CLASS_WARNING;801 enum log_colorize log_colorize = LOG_COLORIZE_AUTO;802 bool log_syslog = true;803 const char *select = NULL;
80 unmodified lines
884 check_config = true;885 break;886887 case OPT_CACHE:889 cache_path = optarg;888 cmdline_overrides.conf.cache_path = optarg;889 break;890891 case 'o':892 cmdline_overrides.conf.output = optarg;
854 unmodified lines
1747 if (cmdline_overrides.delayed_filter_ms_set)1748 conf.delayed_filter_ms = cmdline_overrides.conf.delayed_filter_ms;1749 if (cmdline_overrides.delayed_filter_limit_set)1750 conf.delayed_filter_limit = cmdline_overrides.conf.delayed_filter_limit;1751 if (cmdline_overrides.conf.cache_path != NULL) {1752 free(conf.cache_path);1753 conf.cache_path = strdup(cmdline_overrides.conf.cache_path);1754 }17551756 if (conf.dmenu.enabled) {1757 /* We don't have any meta data in dmenu mode */1758 conf.match_fields = MATCH_NAME;
87 unmodified lines
1846 }18471848 struct context ctx = {1849 .conf = &conf,1847 .cache_path = cache_path,1850 .cache_path = conf.cache_path,1851 .render = render,1852 .matches = matches,1853 .apps = apps,1854 .themes = &themes,
41 unmodified lines
1896 break;1897 }18981899 if (wayl_update_cache(wayl))1897 write_cache(cache_path, apps, conf.dmenu.enabled);1900 write_cache(conf.cache_path, apps, conf.dmenu.enabled);19011902 ret = wayl_exit_code(wayl);19031904out:
57 unmodified lines