wayland: allow setting namespace in config and from the command line
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by frosty · committed by Daniel Eklöf · parent b789998 · Browse files · 9 files·+37 added−2 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
9 files+37 added−2 removed
- other:+37 added−2 removed
Provenance
- Commit
5255c0a- Tree
51f6c86- Author
frosty <passedgoandgot200@disroot.org>- Committer
Daniel Eklöf <daniel@ekloef.se>- Parent
b789998
9 files changed+37 added−2 removed
modified:completions/fish/fuzzel.fish+1 added
9 unmodified lines10 11 complete -c fuzzel -f12 complete -c fuzzel -r -s c -l config -d "path to configuration file (XDG_CONFIG_HOME/fuzzel/fuzzel.ini)"13 complete -c fuzzel -r -l cache -d "file to load most recently launched applications from (XDG_CACHE_HOME/fuzzel)"14+complete -c fuzzel -x -s n -l namespace -d "layer shell surface namespace (launcher)"15 complete -c fuzzel -l check-config -d "verify configuration and exit with 0 if ok, otherwise exit with 1"16 complete -c fuzzel -x -s f -l font -a "(fc-list : family | sed 's/,/\n/g' | sort | uniq)" -d "font name and style in fontconfig format (monospace)"17 complete -c fuzzel -l use-bold -d "allow fuzzel to use bold fonts"18 complete -c fuzzel -x -s o -l output -a "(__fish_complete_fuzzel_output)" -d "output (monitor) do display on (none)"64 unmodified linesmodified:completions/zsh/_fuzzel+1 added
2 unmodified lines3 _arguments \4 -s \5 '--config[path to configuration file (XDG_CONFIG_HOME/fuzzel/fuzzel.ini)]:config:_files' \6 '--cache[file to load most recently launched applications from (XDG_CACHE_HOME/fuzzel)]:cache:_files' \7+ '(-n --namespace)'{-n,--namespace}'[layer shell surface namespace (launcher)]:()' \8 '--check-config[verify configuration and exit with 0 if ok, otherwise exit with 1]' \9 '(-v --version)'{-v,--version}'[show the version number and quit]' \10 '(-h --help)'{-h,--help}'[show help message and quit]' \11 '(-o --output)'{-o,--output}'[output (monitor) to display on (none)]:output:->outputs' \81 unmodified linesmodified:doc/fuzzel.1.scd+7 added
23 unmodified lines24 *--check-config*25 Verify configuration and then exit with 0 if ok, otherwise exit26 with 1.27 28+*-n*,*--namespace*=_NAMESPACE_29+ Specifies the namespace for the spawned layer shell surface. Useful for30+ blocking fuzzel out from screencasts in your compositor if it shows31+ sensitive information, such as passwords.32+33+ Default: _launcher_34+35 *--cache*=_PATH_36 Use a custom cache location. Fuzzel uses this file to cache the37 most commonly launched applications (to be able to sort them at38 the top).469 unmodified linesmodified:doc/fuzzel.ini.5.scd+7 added
37 unmodified lines38 - Nested imports are allowed.39 40 Default: _not set_.41 42+*namespace*43+ Namespace for the spawned layer shell surface. Useful for blocking44+ fuzzel out from screencasts in your compositor if it shows sensitive45+ information, such as passwords.46+47+ Default: _launcher_48+49 *output*50 Output (monitor) to display on. You can list the available outputs51 with *wlr-randr* or with Sway using *swaymsg -t get_outputs*.52 526 unmodified linesmodified:CHANGELOG.md+2 added
32 unmodified lines33 ### Added34 35 * Add support for fallback icons in dmenu mode using comma-separated36 values in the icon metadata ([#504][504]).37+* `--namespace` command line option ([#512][512]).38 39 [504]: https://codeberg.org/dnkl/fuzzel/pulls/50440+[512]: https://codeberg.org/dnkl/fuzzel/pulls/51241 42 43 ### Changed44 925 unmodified linesmodified:config.c+5 added
755 unmodified lines756 free(_include_path);757 return ret;758 }759 760+ else if (strcmp(key, "namespace") == 0)761+ return value_to_str(ctx, &conf->namespace);762+763 else if (strcmp(key, "output") == 0)764 return value_to_str(ctx, &conf->output);765 766 else if (strcmp(key, "font") == 0)823 unmodified lines1590 {1591 bool ret = !errors_are_fatal;1592 *conf = (struct config) {1593 .output = NULL,1594+ .namespace = xstrdup("launcher"),1595 .prompt = xc32dup(U"> "),1596 .placeholder = xc32dup(U""),1597 .search_text = xc32dup(U""),1598 .match_fields = MATCH_FILENAME | MATCH_NAME | MATCH_GENERIC,125 unmodified lines1724 1725 void1726 config_free(struct config *conf)1727 {1728+ free(conf->namespace);1729 free(conf->output);1730 free(conf->prompt);1731 free(conf->placeholder);1732 free(conf->search_text);18 unmodified linesmodified:config.h+2 added
103 unmodified lines104 char32_t *search_text;105 bool prompt_only;106 enum match_fields match_fields;107 108+ char *namespace;109+110 struct {111 char32_t character;112 bool enabled;113 bool character_set;102 unmodified linesmodified:main.c+11 added-1 removed
324 unmodified lines325 " --check-config verify configuration, exit with 0 if ok,\n"326 " otherwise exit with 1\n"327 " --cache=PATH load most recently launched applications from\n"328 " PATH (XDG_CACHE_HOME/fuzzel)\n"329+ " -n,--namespace=NAMESPACE layer shell surface namespace\n"330 " -o,--output=OUTPUT output (monitor) to display on (none)\n"331 " -f,--font=FONT font name and style, in FontConfig format\n"332 " (monospace)\n"333 " --use-bold allow fuzzel to use bold fonts\n"424 unmodified lines758 759 static const struct option longopts[] = {760 {"config", required_argument, 0, OPT_CONFIG},761 {"check-config", no_argument, 0, OPT_CHECK_CONFIG},762+ {"namespace", required_argument, 0, 'n'},763 {"cache", required_argument, 0, OPT_CACHE},764 {"output" , required_argument, 0, 'o'},765 {"font", required_argument, 0, 'f'},766 {"use-bold", no_argument, 0, OPT_USE_BOLD},148 unmodified lines915 free(copy);916 }917 918 while (true) {917- int c = getopt_long(argc, argv, ":o:f:D:IF:ia:l:w:x:y:p:P:b:t:m:s:S:M:B:r:C:T:dRvh", longopts, NULL);919+ int c = getopt_long(argc, argv, ":n:o:f:D:IF:ia:l:w:x:y:p:P:b:t:m:s:S:M:B:r:C:T:dRvh", longopts, NULL);920 if (c == -1)921 break;922 923 switch (c) {4 unmodified lines928 case OPT_CHECK_CONFIG:929 check_config = true;930 break;931 932+ case 'n':933+ cmdline_overrides.conf.namespace = optarg;934+ break;935+936 case OPT_CACHE:937 cmdline_overrides.conf.cache_path = optarg;938 break;939 787 unmodified lines1727 if (cmdline_overrides.conf.output != NULL) {1728 free(conf.output);1729 conf.output = xstrdup(cmdline_overrides.conf.output);1730 }1731+ if (cmdline_overrides.conf.namespace != NULL) {1732+ free(conf.namespace);1733+ conf.namespace = xstrdup(cmdline_overrides.conf.namespace);1734+ }1735 if (cmdline_overrides.conf.prompt != NULL) {1736 free(conf.prompt);1737 conf.prompt = cmdline_overrides.conf.prompt;1738 if (cmdline_overrides.prompt_only_set)350 unmodified linesmodified:wayland.c+1 added-1 removed
2378 unmodified lines2379 2380 wayl->layer_surface = zwlr_layer_shell_v1_get_layer_surface(2381 wayl->layer_shell, wayl->surface,2382 wayl->monitor != NULL ? wayl->monitor->output : NULL,2383- conf->layer, "launcher");2383+ conf->layer, conf->namespace);2384 2385 if (wayl->layer_surface == NULL) {2386 LOG_ERR("failed to create layer shell surface");2387 goto out;136 unmodified lines