| 1 |
# mako(1) completion |
| 2 |
|
| 3 |
_mako() |
| 4 |
{ |
| 5 |
local cur prev opts |
| 6 |
_get_comp_words_by_ref cur prev |
| 7 |
|
| 8 |
opts=( |
| 9 |
'--help' |
| 10 |
'-h' |
| 11 |
'--config' |
| 12 |
'-c' |
| 13 |
'--background-color' |
| 14 |
'--text-color' |
| 15 |
'--width' |
| 16 |
'--height' |
| 17 |
'--margin' |
| 18 |
'--padding' |
| 19 |
'--border-size' |
| 20 |
'--border-color' |
| 21 |
'--border-radius' |
| 22 |
'--progress-color' |
| 23 |
'--icons' |
| 24 |
'--icon-path' |
| 25 |
'--max-icon-size' |
| 26 |
'--icon-border-radius' |
| 27 |
'--markup' |
| 28 |
'--actions' |
| 29 |
'--format' |
| 30 |
'--hidden-format' |
| 31 |
'--max-visible' |
| 32 |
'--max-history' |
| 33 |
'--history' |
| 34 |
'--sort' |
| 35 |
'--default-timeout' |
| 36 |
'--ignore-timeout' |
| 37 |
'--output' |
| 38 |
'--layer' |
| 39 |
'--anchor' |
| 40 |
) |
| 41 |
|
| 42 |
case $prev in |
| 43 |
-c|--config) |
| 44 |
COMPREPLY=($(compgen -f -- "$cur")) |
| 45 |
return |
| 46 |
;; |
| 47 |
--icons|--markup|--actions|--history|--ignore-timeout) |
| 48 |
COMPREPLY=($(compgen -W "0 1" -- "$cur")) |
| 49 |
return |
| 50 |
;; |
| 51 |
--output) |
| 52 |
local outputs |
| 53 |
outputs="$(swaymsg -t get_outputs 2>/dev/null | \ |
| 54 |
jq -r '.[] | select(.active) | "\(.name)\t\(.make) \(.model)"' 2>/dev/null)" |
| 55 |
COMPREPLY=($(compgen -W "$outputs" -- "$cur")) |
| 56 |
return |
| 57 |
;; |
| 58 |
--layer) |
| 59 |
COMPREPLY=($(compgen -W "background bottom top overlay" -- "$cur")) |
| 60 |
return |
| 61 |
;; |
| 62 |
--anchor) |
| 63 |
local pos |
| 64 |
pos=( |
| 65 |
'top-right' |
| 66 |
'top-center' |
| 67 |
'top-left' |
| 68 |
'bottom-right' |
| 69 |
'bottom-center' |
| 70 |
'bottom-left' |
| 71 |
'center-right' |
| 72 |
'center-left' |
| 73 |
'center' |
| 74 |
) |
| 75 |
COMPREPLY=($(compgen -W "${pos[*]}" -- "$cur")) |
| 76 |
return |
| 77 |
;; |
| 78 |
esac |
| 79 |
|
| 80 |
if [[ "$prev" != -* ]]; then |
| 81 |
COMPREPLY=($(compgen -W "${opts[*]}" -- "$cur")) |
| 82 |
return |
| 83 |
fi |
| 84 |
|
| 85 |
} && |
| 86 |
complete -F _mako mako |