aboutsummaryrefslogtreecommitdiffstats
path: root/completions
diff options
context:
space:
mode:
authorLibravatar Eric Engestrom <eric.engestrom@intel.com>2018-07-27 16:31:30 +0100
committerLibravatar Eric Engestrom <eric.engestrom@intel.com>2018-07-30 15:56:15 +0100
commit4a8a19d21f91a3126d83ac42d6a96900f42ba64c (patch)
tree417a08b9cc37c07ce01f1084f5f59544b43da874 /completions
parentbash: add completion for swaymsg (diff)
downloadsway-4a8a19d21f91a3126d83ac42d6a96900f42ba64c.tar.gz
sway-4a8a19d21f91a3126d83ac42d6a96900f42ba64c.tar.zst
sway-4a8a19d21f91a3126d83ac42d6a96900f42ba64c.zip
bash: add completion for swaylock
Diffstat (limited to 'completions')
-rw-r--r--completions/bash/swaylock66
1 files changed, 66 insertions, 0 deletions
diff --git a/completions/bash/swaylock b/completions/bash/swaylock
new file mode 100644
index 00000000..33925480
--- /dev/null
+++ b/completions/bash/swaylock
@@ -0,0 +1,66 @@
1# swaylock(1) completion
2
3_swaylock()
4{
5 local cur prev
6 _get_comp_words_by_ref -n : cur prev
7
8 short=(
9 -h
10 -c
11 -s
12 -t
13 -v
14 -i
15 -u
16 -f
17 )
18
19 long=(
20 --help
21 --color
22 --scaling
23 --tiling
24 --version
25 --image
26 --no-unlock-indicator
27 --daemonize
28 )
29
30 scaling=(
31 'stretch'
32 'fill'
33 'fit'
34 'center'
35 'tile'
36 )
37
38 case $prev in
39 -c|--color)
40 return
41 ;;
42 --scaling)
43 COMPREPLY=($(compgen -W "${scaling[*]}" -- "$cur"))
44 return
45 ;;
46 -i|--image)
47 if grep -q : <<< "$cur"; then
48 output="${cur%%:*}:"
49 cur="${cur#*:}"
50 else
51 output=
52 fi
53 COMPREPLY=($(compgen -f -- "$cur"))
54 return
55 ;;
56 esac
57
58 if [[ $cur == --* ]]; then
59 COMPREPLY=($(compgen -W "${long[*]}" -- "$cur"))
60 else
61 COMPREPLY=($(compgen -W "${short[*]}" -- "$cur"))
62 COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur"))
63 fi
64
65} &&
66complete -F _swaylock swaylock