river/completions/bash/riverctl

152 lines
4.1 KiB
Plaintext
Raw Permalink Normal View History

2021-03-13 08:54:15 -08:00
function __riverctl_completion ()
{
2024-11-02 08:00:50 -07:00
local rule_actions="float no-float ssd csd tags output position relative-position dimensions fullscreen no-fullscreen warp no-warp"
2021-03-13 08:54:15 -08:00
if [ "${COMP_CWORD}" -eq 1 ]
then
OPTS=" \
2022-08-30 06:26:35 -07:00
keyboard-group-create \
keyboard-group-destroy \
keyboard-group-add \
keyboard-group-remove \
2023-01-06 07:36:00 -08:00
keyboard-layout \
keyboard-layout-file \
close \
2021-03-13 08:54:15 -08:00
exit \
focus-output \
focus-view \
2021-06-13 02:20:57 -07:00
input \
list-inputs \
list-input-configs \
2021-03-13 08:54:15 -08:00
move \
resize \
rule-add \
rule-del \
list-rules \
2021-03-13 08:54:15 -08:00
snap \
send-to-output \
spawn \
swap \
toggle-float \
toggle-fullscreen \
zoom \
default-layout \
output-layout \
send-layout-cmd \
2021-03-13 08:54:15 -08:00
set-focused-tags \
2021-07-06 23:51:00 -07:00
focus-previous-tags \
send-to-previous-tags \
2021-03-13 08:54:15 -08:00
set-view-tags \
toggle-focused-tags \
toggle-view-tags \
spawn-tagmask \
declare-mode \
enter-mode \
map \
map-pointer \
map-switch \
2021-03-13 08:54:15 -08:00
unmap \
unmap-pointer \
unmap-switch \
default-attach-mode \
output-attach-mode \
2021-03-13 08:54:15 -08:00
background-color \
border-color-focused \
border-color-unfocused \
border-color-urgent \
2021-03-13 08:54:15 -08:00
border-width \
focus-follows-cursor \
hide-cursor \
2021-03-13 08:54:15 -08:00
set-repeat \
set-cursor-warp \
2021-06-13 02:20:57 -07:00
xcursor-theme"
2021-03-13 08:54:15 -08:00
COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[1]}"))
elif [ "${COMP_CWORD}" -eq 2 ]
then
case "${COMP_WORDS[1]}" in
"focus-output"|"send-to-output") OPTS="next previous up right down left" ;;
"focus-view"|"swap") OPTS="next previous up down left right" ;;
"input") OPTS="$(riverctl list-inputs | sed '/configured:/d')" ;;
2021-03-13 08:54:15 -08:00
"move"|"snap") OPTS="up down left right" ;;
"resize") OPTS="horizontal vertical" ;;
"rule-add"|"rule-del") OPTS="-app-id -title $rule_actions" ;;
"list-rules") OPTS="float ssd tags output position dimensions fullscreen" ;;
"map") OPTS="-release -repeat -layout" ;;
"unmap") OPTS="-release" ;;
"default-attach-mode"|"output-attach-mode") OPTS="top bottom above below after" ;;
"focus-follows-cursor") OPTS="disabled normal always" ;;
"set-cursor-warp") OPTS="disabled on-output-change on-focus-change" ;;
"hide-cursor") OPTS="timeout when-typing" ;;
2021-03-13 08:54:15 -08:00
*) return ;;
esac
COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[2]}"))
2021-06-13 02:20:57 -07:00
elif [ "${COMP_CWORD}" -eq 3 ]
then
if [ "${COMP_WORDS[1]}" == "input" ]
then
OPTS="events \
accel-profile \
pointer-accel \
click-method \
drag \
drag-lock \
disable-while-typing \
disable-while-trackpointing \
2021-06-13 02:20:57 -07:00
middle-emulation \
natural-scroll \
2024-04-11 13:29:43 -07:00
scroll-factor \
2021-06-13 02:20:57 -07:00
left-handed \
tap \
tap-button-map \
scroll-method \
2024-02-20 12:54:06 -08:00
scroll-button \
scroll-button-lock \
2024-02-20 12:54:06 -08:00
map-to-output"
COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[3]}"))
elif [ "${COMP_WORDS[1]}" == "hide-cursor" ]
then
case "${COMP_WORDS[2]}" in
"when-typing") OPTS="enabled disabled" ;;
*) return ;;
esac
COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[3]}"))
2021-06-13 02:20:57 -07:00
fi
elif [ "${COMP_CWORD}" -eq 4 ]
then
if [ "${COMP_WORDS[1]}" == "input" ]
then
case "${COMP_WORDS[3]}" in
"events") OPTS="enabled disabled disabled-on-external-mouse" ;;
"accel-profile") OPTS="none flat adaptive" ;;
"click-method") OPTS="none button-areas clickfinger" ;;
"drag"|"drag-lock"|"disable-while-typing"|"middle-emulation"|"left-handed"|"tap"|"scroll-button-lock") OPTS="enabled disabled" ;;
2021-06-13 02:20:57 -07:00
"tap-button-map") OPTS="left-right-middle left-middle-right" ;;
"scroll-method") OPTS="none two-finger edge button" ;;
*) return ;;
esac
COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[4]}"))
elif [ "${COMP_WORDS[1]:0:5}" == "rule-" ]
then
case "${COMP_WORDS[2]}" in
"-app-id") OPTS="-title $rule_actions" ;;
"-title") OPTS="-app-id $rule_actions" ;;
*) return ;;
esac
COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[4]}"))
fi
elif [ "${COMP_CWORD}" -eq 6 ]
then
if [ "${COMP_WORDS[1]:0:5}" == "rule-" ]
then
case "${COMP_WORDS[4]}" in
"-app-id"|"-title") OPTS="$rule_actions" ;;
*) return ;;
esac
COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[6]}"))
2021-06-13 02:20:57 -07:00
fi
2021-03-13 08:54:15 -08:00
else
return
fi
}
complete -F __riverctl_completion riverctl