2021-03-13 08:54:15 -08:00
|
|
|
function __riverctl_completion ()
|
|
|
|
{
|
2023-11-06 07:53:44 -08:00
|
|
|
local rule_actions="float no-float ssd csd tag output position dimensions fullscreen no-fullscreen"
|
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 \
|
2022-09-17 02:26:45 -07:00
|
|
|
keyboard-group-add \
|
|
|
|
keyboard-group-remove \
|
2023-01-06 07:36:00 -08:00
|
|
|
keyboard-layout \
|
2023-08-12 12:30:55 -07:00
|
|
|
keyboard-layout-file \
|
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 \
|
2023-03-12 07:40:42 -07:00
|
|
|
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 \
|
2021-04-26 12:03:04 -07:00
|
|
|
default-layout \
|
|
|
|
output-layout \
|
2021-07-15 06:35:56 -07:00
|
|
|
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 \
|
2021-09-11 13:21:48 -07:00
|
|
|
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 \
|
2022-02-07 05:51:23 -08:00
|
|
|
map-switch \
|
2021-03-13 08:54:15 -08:00
|
|
|
unmap \
|
|
|
|
unmap-pointer \
|
2022-02-07 05:51:23 -08:00
|
|
|
unmap-switch \
|
2021-03-13 08:54:15 -08:00
|
|
|
attach-mode \
|
|
|
|
background-color \
|
|
|
|
border-color-focused \
|
|
|
|
border-color-unfocused \
|
2021-08-12 07:16:23 -07:00
|
|
|
border-color-urgent \
|
2021-03-13 08:54:15 -08:00
|
|
|
border-width \
|
2021-07-02 09:28:26 -07:00
|
|
|
focus-follows-cursor \
|
2022-04-20 10:00:03 -07:00
|
|
|
hide-cursor \
|
2021-03-13 08:54:15 -08:00
|
|
|
set-repeat \
|
2021-06-22 06:53:22 -07:00
|
|
|
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
|
2023-07-07 21:30:27 -07:00
|
|
|
"focus-output"|"send-to-output") OPTS="next previous" ;;
|
|
|
|
"focus-view"|"swap") OPTS="next previous up down left right" ;;
|
2023-10-22 03:48:04 -07:00
|
|
|
"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" ;;
|
riverctl: rule-{add,del}: reorder parameters
Previous order was (action, conditions, action argument), current is
(conditions, action, action argument). The old one was an expansion of
(action, conditions), which itself most likely came from the separate
<action>-filter-add commands. On the other hand, the new order keeps
action and its argument together and is in line with the logical flow
(check conditions, apply action).
On shell completions: only bash absolutely needed to be updated. fish
and zsh slightly misbehave regardless of the order.
2023-10-01 08:49:21 -07:00
|
|
|
"rule-add"|"rule-del") OPTS="-app-id -title $rule_actions" ;;
|
2023-11-06 07:53:44 -08:00
|
|
|
"list-rules") OPTS="float ssd tag output position dimensions fullscreen" ;;
|
2022-04-20 06:38:18 -07:00
|
|
|
"map") OPTS="-release -repeat -layout" ;;
|
2021-08-15 05:49:11 -07:00
|
|
|
"unmap") OPTS="-release" ;;
|
2021-03-13 08:54:15 -08:00
|
|
|
"attach-mode") OPTS="top bottom" ;;
|
2022-06-03 02:09:18 -07:00
|
|
|
"focus-follows-cursor") OPTS="disabled normal always" ;;
|
2022-08-01 17:31:50 -07:00
|
|
|
"set-cursor-warp") OPTS="disabled on-output-change on-focus-change" ;;
|
2022-04-20 10:00:03 -07:00
|
|
|
"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 \
|
|
|
|
middle-emulation \
|
|
|
|
natural-scroll \
|
|
|
|
left-handed \
|
|
|
|
tap \
|
|
|
|
tap-button-map \
|
|
|
|
scroll-method \
|
|
|
|
scroll-button"
|
2023-10-22 03:48:04 -07:00
|
|
|
COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[3]}"))
|
2022-04-20 10:00:03 -07:00
|
|
|
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") OPTS="enabled disabled" ;;
|
|
|
|
"tap-button-map") OPTS="left-right-middle left-middle-right" ;;
|
|
|
|
"scroll-method") OPTS="none two-finger edge button" ;;
|
|
|
|
*) return ;;
|
|
|
|
esac
|
2023-10-22 03:48:04 -07:00
|
|
|
COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[4]}"))
|
riverctl: rule-{add,del}: reorder parameters
Previous order was (action, conditions, action argument), current is
(conditions, action, action argument). The old one was an expansion of
(action, conditions), which itself most likely came from the separate
<action>-filter-add commands. On the other hand, the new order keeps
action and its argument together and is in line with the logical flow
(check conditions, apply action).
On shell completions: only bash absolutely needed to be updated. fish
and zsh slightly misbehave regardless of the order.
2023-10-01 08:49:21 -07:00
|
|
|
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
|