summaryrefslogtreecommitdiff
path: root/completions/tofi
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2021-11-06 18:44:27 +0000
committerPhil Jones <philj56@gmail.com>2021-11-06 19:02:29 +0000
commitae23e86114f559ce6d01a3e2499fc5417dc90d37 (patch)
treec55d7f3c3b131efd50ec2a6f884b48f9ce250c63 /completions/tofi
parentc28c5249c4d3ba7076e2c6ea598e3ad93a168301 (diff)
Start conversion to tofi.
Diffstat (limited to 'completions/tofi')
-rw-r--r--completions/tofi55
1 files changed, 55 insertions, 0 deletions
diff --git a/completions/tofi b/completions/tofi
new file mode 100644
index 0000000..be5a7b1
--- /dev/null
+++ b/completions/tofi
@@ -0,0 +1,55 @@
+# vi: ft=bash
+
+containsElement () {
+ local e match="$1"
+ shift
+ for e; do [[ "$e" =~ $match ]] && return 0; done
+ return 1
+}
+
+_greetd_mini_wl_greeter()
+{
+ 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"
+
+
+ case "${prev}" in
+ --user|-u)
+ COMPREPLY=( $(compgen -W "${users}" -- ${cur}) )
+ return 0
+ ;;
+ --command|-c)
+ 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
+ ;;
+ *)
+ remaining=$(echo ${opts[@]} ${COMP_WORDS[@]} ${COMP_WORDS[@]} | tr ' ' '\n' | sort | uniq -u)
+ COMPREPLY=( $(compgen -W "${remaining}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ true
+}
+complete -F _greetd_mini_wl_greeter greetd-mini-wl-greeter