blob: 246e840a1e4958fa410d899110a2a6caca00a9db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# 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"
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
;;
--?[^w]*)
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
|