Isaac Freund 46f77f30dc
Seat: put all keyboards in a single group
Deprecate and ignore the riverctl commands for creating explicit
keyboard groups.

In my mind, the only reason to have more than one keyboard group is if
different keyboard devices are assigned different keymaps or repeat
rates. River does not currently allow such things to be configured
however.

When river eventually makes it possible to configure different keymaps
and repeat rates per keyboard device, there is no reason we can't 100%
automatically group keyboards based on the keymap/repeat rate.

Exposing this keyboard group abstraction to the user is just bad UX.

Failing to group keyboards automatically also creates confusing/buggy
behavior for the user if the hardware, for example, exposes some of the
the XF86 buttons on a laptop as a separate keyboard device from the main
keyboard. Creating keybindings for these XF86 buttons that use modifiers
doesn't work by default, but there's no reason it shouldn't just work.

Closes: https://codeberg.org/river/river/issues/1138
2025-03-29 15:44:56 +01:00

148 lines
4.0 KiB
Plaintext

function __riverctl_completion ()
{
local rule_actions="float no-float ssd csd tags output position dimensions fullscreen no-fullscreen"
if [ "${COMP_CWORD}" -eq 1 ]
then
OPTS=" \
keyboard-layout \
keyboard-layout-file \
close \
exit \
focus-output \
focus-view \
input \
list-inputs \
list-input-configs \
move \
resize \
rule-add \
rule-del \
list-rules \
snap \
send-to-output \
spawn \
swap \
toggle-float \
toggle-fullscreen \
zoom \
default-layout \
output-layout \
send-layout-cmd \
set-focused-tags \
focus-previous-tags \
send-to-previous-tags \
set-view-tags \
toggle-focused-tags \
toggle-view-tags \
spawn-tagmask \
declare-mode \
enter-mode \
map \
map-pointer \
map-switch \
unmap \
unmap-pointer \
unmap-switch \
default-attach-mode \
output-attach-mode \
background-color \
border-color-focused \
border-color-unfocused \
border-color-urgent \
border-width \
focus-follows-cursor \
hide-cursor \
set-repeat \
set-cursor-warp \
xcursor-theme"
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')" ;;
"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" ;;
*) return ;;
esac
COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[2]}"))
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 \
middle-emulation \
natural-scroll \
scroll-factor \
left-handed \
tap \
tap-button-map \
scroll-method \
scroll-button \
scroll-button-lock \
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]}"))
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" ;;
"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]}"))
fi
else
return
fi
}
complete -F __riverctl_completion riverctl