completions: Add missing completions
Added: * close (bash) * focus-output args: up right down left (bash,fish,zsh) * send-to-output args: up right down left (bash,fish,zsh) * default-attach-mode (bash,fish) * output-attach-mode (bash,fish) Zsh only as I don't know how does it works in other shell and so it's still need to be done. * send-to-output flags: -current-tag * keyboard-layout flags: -rules -model -variant -options * [un]map-switch, lid -> close|open and tablet -> on|off Fixed: * rule-add|list-rules actions, rename tag to tags (bash,fish,zsh) Some descriptions probably need to be changed with new args like up, right..
This commit is contained in:
parent
4e48d68485
commit
81f5b970e6
@ -1,6 +1,6 @@
|
||||
function __riverctl_completion ()
|
||||
{
|
||||
local rule_actions="float no-float ssd csd tag output position dimensions fullscreen no-fullscreen"
|
||||
local rule_actions="float no-float ssd csd tags output position dimensions fullscreen no-fullscreen"
|
||||
if [ "${COMP_CWORD}" -eq 1 ]
|
||||
then
|
||||
OPTS=" \
|
||||
@ -10,6 +10,7 @@ function __riverctl_completion ()
|
||||
keyboard-group-remove \
|
||||
keyboard-layout \
|
||||
keyboard-layout-file \
|
||||
close \
|
||||
exit \
|
||||
focus-output \
|
||||
focus-view \
|
||||
@ -46,7 +47,8 @@ function __riverctl_completion ()
|
||||
unmap \
|
||||
unmap-pointer \
|
||||
unmap-switch \
|
||||
attach-mode \
|
||||
default-attach-mode \
|
||||
output-attach-mode \
|
||||
background-color \
|
||||
border-color-focused \
|
||||
border-color-unfocused \
|
||||
@ -61,16 +63,16 @@ function __riverctl_completion ()
|
||||
elif [ "${COMP_CWORD}" -eq 2 ]
|
||||
then
|
||||
case "${COMP_WORDS[1]}" in
|
||||
"focus-output"|"send-to-output") OPTS="next previous" ;;
|
||||
"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 tag output position dimensions fullscreen" ;;
|
||||
"list-rules") OPTS="float ssd tags output position dimensions fullscreen" ;;
|
||||
"map") OPTS="-release -repeat -layout" ;;
|
||||
"unmap") OPTS="-release" ;;
|
||||
"attach-mode") OPTS="top bottom" ;;
|
||||
"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" ;;
|
||||
|
@ -60,7 +60,8 @@ complete -c riverctl -n '__fish_riverctl_complete_arg 1' -a 'rule-add'
|
||||
complete -c riverctl -n '__fish_riverctl_complete_arg 1' -a 'rule-del' -d 'Delete a rule added with rule-add'
|
||||
complete -c riverctl -n '__fish_riverctl_complete_arg 1' -a 'list-rules' -d 'Print rules in a given list'
|
||||
# Configuration
|
||||
complete -c riverctl -n '__fish_riverctl_complete_arg 1' -a 'attach-mode' -d 'Configure where new views should attach to the view stack'
|
||||
complete -c riverctl -n '__fish_riverctl_complete_arg 1' -a 'default-attach-mode' -d 'Set the attach mode to be used by all outputs by default'
|
||||
complete -c riverctl -n '__fish_riverctl_complete_arg 1' -a 'output-attach-mode' -d 'Set the attach mode of the currently focused output'
|
||||
complete -c riverctl -n '__fish_riverctl_complete_arg 1' -a 'background-color' -d 'Set the background color'
|
||||
complete -c riverctl -n '__fish_riverctl_complete_arg 1' -a 'border-color-focused' -d 'Set the border color of focused views'
|
||||
complete -c riverctl -n '__fish_riverctl_complete_arg 1' -a 'border-color-unfocused' -d 'Set the border color of unfocused views'
|
||||
@ -80,19 +81,20 @@ complete -c riverctl -n '__fish_riverctl_complete_arg 1' -a 'keyboard-layout'
|
||||
complete -c riverctl -n '__fish_riverctl_complete_arg 1' -a 'keyboard-layout-file' -d 'Set the keyboard layout from a file.'
|
||||
|
||||
# Subcommands
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from focus-output send-to-output' -n '__fish_riverctl_complete_arg 2' -a 'next previous'
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from focus-output send-to-output' -n '__fish_riverctl_complete_arg 2' -a 'next previous up right down left'
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from focus-view swap' -n '__fish_riverctl_complete_arg 2' -a 'next previous up down left right'
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from move snap' -n '__fish_riverctl_complete_arg 2' -a 'up down left right'
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from resize' -n '__fish_riverctl_complete_arg 2' -a 'horizontal vertical'
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from map' -o 'release' -o 'repeat' -o 'layout'
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from unmap' -n '__fish_riverctl_complete_arg 2' -o 'release'
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from attach-mode' -n '__fish_riverctl_complete_arg 2' -a 'top bottom'
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from default-attach-mode' -n '__fish_riverctl_complete_arg 2' -a 'top bottom above below after'
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from output-attach-mode' -n '__fish_riverctl_complete_arg 2' -a 'top bottom above below after'
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from focus-follows-cursor' -n '__fish_riverctl_complete_arg 2' -a 'disabled normal always'
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from set-cursor-warp' -n '__fish_riverctl_complete_arg 2' -a 'disabled on-output-change on-focus-change'
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from list-rules' -n '__fish_riverctl_complete_arg 2' -a 'float ssd tag output position dimensions fullscreen'
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from list-rules' -n '__fish_riverctl_complete_arg 2' -a 'float ssd tags output position dimensions fullscreen'
|
||||
|
||||
# Options and subcommands for 'rule-add' and 'rule-del'
|
||||
set -l rule_actions float no-float ssd csd tag output position dimensions fullscreen no-fullscreen
|
||||
set -l rule_actions float no-float ssd csd tags output position dimensions fullscreen no-fullscreen
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from rule-add rule-del' -n "not __fish_seen_subcommand_from $rule_actions" -n 'not __fish_seen_argument -o app-id' -o 'app-id' -r
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from rule-add rule-del' -n "not __fish_seen_subcommand_from $rule_actions" -n 'not __fish_seen_argument -o title' -o 'title' -r
|
||||
complete -c riverctl -n '__fish_seen_subcommand_from rule-add rule-del' -n "not __fish_seen_subcommand_from $rule_actions" -n 'test (math (count (commandline -opc)) % 2) -eq 0' -a "$rule_actions"
|
||||
|
@ -99,8 +99,9 @@ _riverctl()
|
||||
commands) _alternative 'common-commands:common:_riverctl_commands' ;;
|
||||
args)
|
||||
case "$line[1]" in
|
||||
focus-output) _alternative 'arguments:args:(next previous)' ;;
|
||||
focus-output) _alternative 'arguments:args:(next previous up right down left)' ;;
|
||||
focus-view) _alternative 'arguments:args:(next previous up down left right)' ;;
|
||||
keyboard-layout) _arguments '*::optional:(-rules -model -variant -options)' ;;
|
||||
input)
|
||||
_arguments '1: :->name' '2: :->commands' ':: :->args'
|
||||
|
||||
@ -152,10 +153,24 @@ _riverctl()
|
||||
move) _alternative 'arguments:args:(up down left right)' ;;
|
||||
resize) _alternative 'arguments:args:(horizontal vertical)' ;;
|
||||
snap) _alternative 'arguments:args:(up down left right)' ;;
|
||||
send-to-output) _alternative 'arguments:args:(next previous)' ;;
|
||||
send-to-output) _arguments \
|
||||
'1::optional:(-current-tag)' \
|
||||
'::args:(next previous up right down left)'
|
||||
;;
|
||||
swap) _alternative 'arguments:args:(next previous up down left right)' ;;
|
||||
map) _alternative 'arguments:optional:(-release -repeat -layout)' ;;
|
||||
unmap) _alternative 'arguments:optional:(-release)' ;;
|
||||
map-switch | unmap-switch)
|
||||
_arguments '1: :' '2:args:(lid tablet)' '3:args:->args'
|
||||
case "$state" in
|
||||
args)
|
||||
case "$line[2]" in
|
||||
lid) _alternative 'arguments:args:(close open)' ;;
|
||||
tablet) _alternative 'arguments:args:(on off)' ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
default-attach-mode) _alternative 'arguments:args:(top bottom above below after)' ;;
|
||||
output-attach-mode) _alternative 'arguments:args:(top bottom above below after)' ;;
|
||||
focus-follows-cursor) _alternative 'arguments:args:(disabled normal always)' ;;
|
||||
@ -189,9 +204,9 @@ _riverctl()
|
||||
# In case of a new rule added in river, we just need
|
||||
# to add it to the third option between '()',
|
||||
# i.e (float no-float <new-option>)
|
||||
_arguments '1: :(-app-id -title)' '2: : ' ':: :(float no-float ssd csd tag output position dimensions fullscreen no-fullscreen)'
|
||||
_arguments '1: :(-app-id -title)' '2: : ' ':: :(float no-float ssd csd tags output position dimensions fullscreen no-fullscreen)'
|
||||
;;
|
||||
list-rules) _alternative 'arguments:args:(float ssd tag output position dimensions fullscreen)' ;;
|
||||
list-rules) _alternative 'arguments:args:(float ssd tags output position dimensions fullscreen)' ;;
|
||||
*) return 0 ;;
|
||||
esac
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user