diff options
-rw-r--r-- | completions/tofi | 81 | ||||
-rw-r--r-- | src/config.c | 2 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | themes/dmenu | 2 | ||||
-rw-r--r-- | themes/dos | 2 | ||||
-rw-r--r-- | themes/fullscreen | 2 |
6 files changed, 52 insertions, 41 deletions
diff --git a/completions/tofi b/completions/tofi index be5a7b1..d997183 100644 --- a/completions/tofi +++ b/completions/tofi @@ -1,55 +1,66 @@ # vi: ft=bash -containsElement () { - local e match="$1" - shift - for e; do [[ "$e" =~ $match ]] && return 0; done - return 1 -} - -_greetd_mini_wl_greeter() +_tofi() { - local cur prev opts remaining - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - opts="--background-image --background-color --border-width --border-color --outline-width --outline-color --entry-padding --entry-color --text-color --font-name --font-size --password-character --command --user --width-characters --wide-layout --hide-cursor --help" + local cur prev words cword + _init_completion || return + words=( + --help + --config + --anchor + --background-color + --corner-radius + --font + --font-size + --num-results + --selection-color + --outline-width + --outline-color + --prompt-text + --result-spacing + --min-input-width + --border-width + --border-color + --text-color + --width + --height + --margin-top + --margin-bottom + --margin-left + --margin-right + --padding-top + --padding-bottom + --padding-left + --padding-right + --horizontal + --hide-cursor + --history + --hint-font + ) case "${prev}" in - --user|-u) - COMPREPLY=( $(compgen -W "${users}" -- ${cur}) ) - return 0 - ;; - --command|-c) + --font) + ;& + --config|-c) + _filedir return 0 ;; - --background-image|-b) - if ! containsElement '.*\.png' "${COMP_WORDS[@]}"; then - _filedir '*@(png)' - fi - return 0 - ;; - --wide-layout|-w) - ;& # Fallthrough - --hide-cursor|-H) - ;& # Fallthrough --help|-h) ;; - *) + --*) return 0 ;; esac case "${cur}" in - -[a-zA-Z]) - COMPREPLY=$cur + -[ch]) + COMPREPLY=($cur) ;; *) - remaining=$(echo ${opts[@]} ${COMP_WORDS[@]} ${COMP_WORDS[@]} | tr ' ' '\n' | sort | uniq -u) - COMPREPLY=( $(compgen -W "${remaining}" -- ${cur}) ) + COMPREPLY=($(compgen -W "${words[*]}" -- ${cur})) return 0 ;; esac - true } -complete -F _greetd_mini_wl_greeter greetd-mini-wl-greeter +complete -F _tofi tofi +complete -F _tofi tofi-run diff --git a/src/config.c b/src/config.c index fc850e5..23faa24 100644 --- a/src/config.c +++ b/src/config.c @@ -237,7 +237,7 @@ bool parse_option(struct tofi *tofi, const char *filename, size_t lineno, const tofi->window.entry.background_color = parse_color(filename, lineno, value, &err); } else if (strcasecmp(option, "corner-radius") == 0) { tofi->window.entry.corner_radius = parse_uint32(filename, lineno, value, &err); - } else if (strcasecmp(option, "font-name") == 0) { + } else if (strcasecmp(option, "font") == 0) { snprintf(tofi->window.entry.font_name, N_ELEM(tofi->window.entry.font_name), "%s", value); } else if (strcasecmp(option, "font-size") == 0) { tofi->window.entry.font_size = parse_uint32(filename, lineno, value, &err); @@ -562,7 +562,7 @@ static void usage() "Usage: tofi [options]\n" " -h, --help Print this message and exit.\n" " -c, --config Specify a config file.\n" -" --font-name <name|path> Font to use.\n" +" --font <name|path> Font to use.\n" " --font-size <pt> Point size of text.\n" " --background-color <color> Color of the background.\n" " --outline-width <px> Width of the border outlines.\n" @@ -603,7 +603,7 @@ static void parse_args(struct tofi *tofi, int argc, char *argv[]) {"anchor", required_argument, NULL, 0}, {"background-color", required_argument, NULL, 0}, {"corner-radius", required_argument, NULL, 0}, - {"font-name", required_argument, NULL, 0}, + {"font", required_argument, NULL, 0}, {"font-size", required_argument, NULL, 0}, {"num-results", required_argument, NULL, 0}, {"selection-color", required_argument, NULL, 0}, diff --git a/themes/dmenu b/themes/dmenu index db37290..1451ed8 100644 --- a/themes/dmenu +++ b/themes/dmenu @@ -4,7 +4,7 @@ height = 60 horizontal = true font-size = 14 prompt-text = " run: " -font-name = monospace +font = monospace outline-width = 0 border-width = 0 background-color = #000000 @@ -1,4 +1,4 @@ -font-name = VT323 +font = VT323 corner-radius = 120 outline-color = #D3D1B9 outline-width = 6 diff --git a/themes/fullscreen b/themes/fullscreen index 6aef12f..c917569 100644 --- a/themes/fullscreen +++ b/themes/fullscreen @@ -5,5 +5,5 @@ outline-width = 0 padding-left = 35% padding-top = 35% result-spacing = 50 -font-name = monospace +font = monospace background-color = #000A |