2021-03-13 08:06:39 -08:00
|
|
|
#compdef riverctl
|
2021-06-14 03:26:59 -07:00
|
|
|
#
|
2021-11-01 03:28:43 -07:00
|
|
|
# Completion script for riverctl, part of river <https://github.com/riverwm/river>
|
2021-03-13 08:06:39 -08:00
|
|
|
|
2023-10-17 07:51:22 -07:00
|
|
|
# This is the list of all riverctl first argument, i.e `riverctl <first_arg>`.
|
|
|
|
# If a command doesn't need completion for subcommands then you just need
|
|
|
|
# to add a line to this list.
|
|
|
|
# Format is '<command-name>:<description>'
|
|
|
|
_riverctl_commands()
|
2021-06-14 03:26:59 -07:00
|
|
|
{
|
2023-10-17 07:51:22 -07:00
|
|
|
local -a riverctl_commands
|
2021-03-13 08:06:39 -08:00
|
|
|
|
2023-10-17 07:51:22 -07:00
|
|
|
riverctl_commands=(
|
2021-06-14 03:26:59 -07:00
|
|
|
# Actions
|
|
|
|
'close:Close the focused view'
|
|
|
|
'exit:Exit the compositor, terminating the Wayland session'
|
|
|
|
'focus-output:Focus the next or previous output'
|
|
|
|
'focus-view:Focus the next or previous view in the stack'
|
|
|
|
'move:Move the focused view in the specified direction'
|
|
|
|
'resize:Resize the focused view along the given axis'
|
|
|
|
'snap:Snap the focused view to the specified screen edge'
|
|
|
|
'send-to-output:Send the focused view to the next or the previous output'
|
|
|
|
'spawn:Run shell_command using /bin/sh -c'
|
|
|
|
'swap:Swap the focused view with the next/previous visible non-floating view'
|
|
|
|
'toggle-float:Toggle the floating state of the focused view'
|
|
|
|
'toggle-fullscreen:Toggle the fullscreen state of the focused view'
|
|
|
|
'zoom:Bump the focused view to the top of the layout stack'
|
|
|
|
'default-layout:Set the layout namespace to be used by all outputs by default.'
|
|
|
|
'output-layout:Set the layout namespace of currently focused output.'
|
2021-10-31 14:32:59 -07:00
|
|
|
'send-layout-cmd:Send command to the layout generator on the currently focused output with matching namespace'
|
2021-06-14 03:26:59 -07:00
|
|
|
# Tag management
|
|
|
|
'set-focused-tags:Show views with tags corresponding to the set bits of tags'
|
|
|
|
'set-view-tags:Assign the currently focused view the tags corresponding to the set bits of tags'
|
|
|
|
'toggle-focused-tags:Toggle visibility of views with tags corresponding to the set bits of tags'
|
|
|
|
'toggle-view-tags:Toggle the tags of the currently focused view'
|
|
|
|
'spawn-tagmask:Set a tagmask to filter the tags assigned to newly spawned views on the focused output'
|
2021-07-06 23:51:00 -07:00
|
|
|
'focus-previous-tags:Sets tags to their previous value on the focused output'
|
2021-09-11 13:21:48 -07:00
|
|
|
'send-to-previous-tags:Assign the currently focused view the previous tags of the focused output'
|
2021-06-14 03:26:59 -07:00
|
|
|
# Mappings
|
|
|
|
'declare-mode:Create a new mode'
|
|
|
|
'enter-mode:Switch to given mode if it exists'
|
|
|
|
'map:Run command when key is pressed while modifiers are held down and in the specified mode'
|
2022-09-12 19:05:21 -07:00
|
|
|
'map-pointer:Move or resize views or run command when button and modifiers are held down while in the specified mode'
|
2022-02-07 05:51:23 -08:00
|
|
|
'map-switch:Run command when river receives a switch event in the specified mode'
|
2021-06-14 03:26:59 -07:00
|
|
|
'unmap:Remove the mapping defined by the arguments'
|
|
|
|
'unmap-pointer:Remove the pointer mapping defined by the arguments'
|
2022-02-07 05:51:23 -08:00
|
|
|
'unmap-switch:Remove the switch mapping defined by the arguments'
|
2023-03-12 07:40:42 -07:00
|
|
|
# Rules
|
|
|
|
'rule-add:Apply an action to matching views'
|
|
|
|
'rule-del:Delete a rule added with rule-add'
|
|
|
|
'list-rules:Print rules in a given list'
|
2021-06-14 03:26:59 -07:00
|
|
|
# Configuration
|
2024-03-05 00:57:29 -08:00
|
|
|
'default-attach-mode:Configure where new views should attach to the view stack'
|
|
|
|
'output-attach-mode:Configure where new views should attach to the view stack of the currently focuesed output'
|
2021-06-14 03:26:59 -07:00
|
|
|
'background-color:Set the background color'
|
|
|
|
'border-color-focused:Set the border color of focused views'
|
|
|
|
'border-color-unfocused:Set the border color of unfocused views'
|
2021-08-12 07:16:23 -07:00
|
|
|
'border-color-urgent:Set the border color of urgent views'
|
2021-06-14 03:26:59 -07:00
|
|
|
'border-width:Set the border width to pixels'
|
|
|
|
'focus-follows-cursor:Configure the focus behavior when moving cursor'
|
2022-04-20 09:59:27 -07:00
|
|
|
'hide-cursor:Hide cursor when typing or after inactivity'
|
2021-06-14 03:26:59 -07:00
|
|
|
'set-repeat:Set the keyboard repeat rate and repeat delay'
|
2021-06-26 10:00:16 -07:00
|
|
|
'set-cursor-warp:Set the cursor warp mode.'
|
2021-06-14 03:26:59 -07:00
|
|
|
'xcursor-theme:Set the xcursor theme'
|
2022-08-30 06:26:35 -07:00
|
|
|
# Keyboard groups
|
|
|
|
'keyboard-group-create:Create a keyboard group'
|
|
|
|
'keyboard-group-destroy:Destroy a keyboard group'
|
2022-09-17 02:26:45 -07:00
|
|
|
'keyboard-group-add:Add a keyboard to a keyboard group'
|
|
|
|
'keyboard-group-remove:Remove a keyboard from a keyboard group'
|
2023-01-06 07:36:00 -08:00
|
|
|
'keyboard-layout:Set the keyboard layout'
|
2023-08-12 12:30:55 -07:00
|
|
|
'keyboard-layout-file:Set the keyboard layout from a file'
|
2021-06-14 03:26:59 -07:00
|
|
|
# Input
|
|
|
|
'input:Configure input devices'
|
|
|
|
'list-inputs:List all input devices'
|
|
|
|
'list-input-configs:List all input configurations'
|
|
|
|
)
|
2021-03-13 08:06:39 -08:00
|
|
|
|
2023-10-17 07:51:22 -07:00
|
|
|
_describe -t command 'command' riverctl_commands
|
2022-04-20 09:59:27 -07:00
|
|
|
}
|
|
|
|
|
2023-10-17 07:51:22 -07:00
|
|
|
# This is the function called for the completion. Commands added in the
|
|
|
|
# riverctl_commands above are generated in the `commands` case, there is
|
|
|
|
# nothing more to do for this. If a command has a subcommand then a new case
|
|
|
|
# need to be added in `args`.
|
|
|
|
# If this is a simple subcommand with simple multi choice, the easier way to
|
|
|
|
# do it is:
|
|
|
|
# <command-name>) _alternative 'arguments:args:(<choice1 choice2)' ;;
|
|
|
|
# If the subcommand also has subcommands then, good luck...
|
|
|
|
# This is really complex, the easiest example to look at is the `hide-cursor` one.
|
2021-06-14 03:26:59 -07:00
|
|
|
_riverctl()
|
|
|
|
{
|
2023-10-17 07:51:22 -07:00
|
|
|
local state line
|
2021-03-13 08:06:39 -08:00
|
|
|
|
2023-10-17 07:51:22 -07:00
|
|
|
_arguments -C \
|
2021-06-14 03:26:59 -07:00
|
|
|
'1: :->commands' \
|
|
|
|
'*:: :->args'
|
|
|
|
|
2023-10-17 07:51:22 -07:00
|
|
|
case "$state" in
|
|
|
|
commands) _alternative 'common-commands:common:_riverctl_commands' ;;
|
2021-06-14 03:26:59 -07:00
|
|
|
args)
|
2023-10-17 07:51:22 -07:00
|
|
|
case "$line[1]" in
|
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..
2024-03-08 04:06:54 -08:00
|
|
|
focus-output) _alternative 'arguments:args:(next previous up right down left)' ;;
|
2023-07-07 21:30:27 -07:00
|
|
|
focus-view) _alternative 'arguments:args:(next previous up down left right)' ;;
|
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..
2024-03-08 04:06:54 -08:00
|
|
|
keyboard-layout) _arguments '*::optional:(-rules -model -variant -options)' ;;
|
2023-10-17 07:51:22 -07:00
|
|
|
input)
|
|
|
|
_arguments '1: :->name' '2: :->commands' ':: :->args'
|
|
|
|
|
|
|
|
case "$state" in
|
2023-10-18 04:23:47 -07:00
|
|
|
name) _alternative "arguments:args:($(riverctl list-inputs | grep -e '^[^[:space:]]'))" ;;
|
2023-10-17 07:51:22 -07:00
|
|
|
commands)
|
|
|
|
local -a input_subcommands
|
|
|
|
input_subcommands=(
|
|
|
|
'events:Configure whether the input devices events will be used by river'
|
|
|
|
'accel-profile:Set the pointer acceleration profile'
|
|
|
|
'pointer-accel:Set the pointer acceleration factor'
|
|
|
|
'click-method:Set the click method'
|
|
|
|
'drag:Enable or disable the tap-and-drag functionality'
|
|
|
|
'drag-lock:Enable or disable the drag lock functionality'
|
|
|
|
'disable-while-typing:Enable or disable the disable-while-typing functionality'
|
2023-01-06 01:30:04 -08:00
|
|
|
'disable-while-trackpointing:Enable or disable the disable-while-trackpointing functionality'
|
2023-10-17 07:51:22 -07:00
|
|
|
'middle-emulation:Enable or disable the middle click emulation functionality'
|
|
|
|
'natural-scroll:Enable or disable the natural scroll functionality'
|
|
|
|
'left-handed:Enable or disable the left handed mode'
|
|
|
|
'tap:Enable or disable the tap functionality'
|
|
|
|
'tap-button-map:Configure the button mapping for tapping'
|
|
|
|
'scroll-method:Set the scroll method'
|
|
|
|
'scroll-button:Set the scroll button'
|
2024-02-20 12:54:06 -08:00
|
|
|
'map-to-output:Map to a given output'
|
2023-10-17 07:51:22 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
_describe -t command 'command' input_subcommands
|
|
|
|
;;
|
|
|
|
args)
|
|
|
|
case "$line[2]" in
|
|
|
|
events) _alternative 'input-cmds:args:(enabled disabled disabled-on-external-mouse)' ;;
|
|
|
|
accel-profile) _alternative 'input-cmds:args:(none flat adaptive)' ;;
|
|
|
|
click-method) _alternative 'input-cmds:args:(none button-area clickfinger)' ;;
|
|
|
|
drag) _alternative 'input-cmds:args:(enabled disabled)' ;;
|
|
|
|
drag-lock) _alternative 'input-cmds:args:(enabled disabled)' ;;
|
|
|
|
disable-while-typing) _alternative 'input-cmds:args:(enabled disabled)' ;;
|
2023-01-06 01:30:04 -08:00
|
|
|
disable-while-trackpointing) _alternative 'input-cmds:args:(enabled disabled)' ;;
|
2023-10-17 07:51:22 -07:00
|
|
|
middle-emulation) _alternative 'input-cmds:args:(enabled disabled)' ;;
|
|
|
|
natural-scroll) _alternative 'input-cmds:args:(enabled disabled)' ;;
|
|
|
|
left-handed) _alternative 'input-cmds:args:(enabled disabled)' ;;
|
|
|
|
tap) _alternative 'input-cmds:args:(enabled disabled)' ;;
|
|
|
|
tap-button-map) _alternative 'input-cmds:args:(left-right-middle left-middle-right)' ;;
|
|
|
|
scroll-method) _alternative 'input-cmds:args:(none two-finger edge button)' ;;
|
|
|
|
*) return 0 ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2021-06-14 03:26:59 -07:00
|
|
|
move) _alternative 'arguments:args:(up down left right)' ;;
|
|
|
|
resize) _alternative 'arguments:args:(horizontal vertical)' ;;
|
|
|
|
snap) _alternative 'arguments:args:(up down left right)' ;;
|
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..
2024-03-08 04:06:54 -08:00
|
|
|
send-to-output) _arguments \
|
|
|
|
'1::optional:(-current-tag)' \
|
|
|
|
'::args:(next previous up right down left)'
|
|
|
|
;;
|
2023-07-07 21:30:27 -07:00
|
|
|
swap) _alternative 'arguments:args:(next previous up down left right)' ;;
|
2022-04-20 06:38:18 -07:00
|
|
|
map) _alternative 'arguments:optional:(-release -repeat -layout)' ;;
|
2021-06-14 03:26:59 -07:00
|
|
|
unmap) _alternative 'arguments:optional:(-release)' ;;
|
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..
2024-03-08 04:06:54 -08:00
|
|
|
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
|
|
|
|
;;
|
2024-03-05 00:57:29 -08:00
|
|
|
default-attach-mode) _alternative 'arguments:args:(top bottom above below after)' ;;
|
|
|
|
output-attach-mode) _alternative 'arguments:args:(top bottom above below after)' ;;
|
2022-06-03 02:09:18 -07:00
|
|
|
focus-follows-cursor) _alternative 'arguments:args:(disabled normal always)' ;;
|
2022-08-01 17:31:50 -07:00
|
|
|
set-cursor-warp) _alternative 'arguments:args:(disabled on-output-change on-focus-change)' ;;
|
2023-10-17 07:51:22 -07:00
|
|
|
hide-cursor)
|
|
|
|
_arguments '1: :->commands' ':: :->args'
|
|
|
|
|
|
|
|
case "$state" in
|
|
|
|
commands)
|
|
|
|
local -a hide_cursor_subcommands
|
|
|
|
hide_cursor_subcommands=(
|
|
|
|
"timeout:Hide cursor if it wasn\'t moved in the last X millisecond, until it is moved again"
|
|
|
|
'when-typing:Enable or disable whether the cursor should be hidden when pressing any non-modifier key'
|
|
|
|
)
|
|
|
|
|
|
|
|
_describe -t command 'command' hide_cursor_subcommands
|
|
|
|
;;
|
|
|
|
args)
|
|
|
|
case "$line[1]" in
|
|
|
|
when-typing) _alternative 'hide-cursor-cmds:args:(enabled disabled)' ;;
|
|
|
|
*) return 0 ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
rule-add | rule-del)
|
|
|
|
# This is not perfect as it only complete if there is
|
|
|
|
# either '-app-id' or '-title'.
|
|
|
|
# The empty action(2) mean that we need an argument
|
|
|
|
# but we don't generate anything for it.
|
|
|
|
# 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>)
|
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..
2024-03-08 04:06:54 -08:00
|
|
|
_arguments '1: :(-app-id -title)' '2: : ' ':: :(float no-float ssd csd tags output position dimensions fullscreen no-fullscreen)'
|
2023-10-17 07:51:22 -07:00
|
|
|
;;
|
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..
2024-03-08 04:06:54 -08:00
|
|
|
list-rules) _alternative 'arguments:args:(float ssd tags output position dimensions fullscreen)' ;;
|
2021-06-14 03:26:59 -07:00
|
|
|
*) return 0 ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
2021-03-13 08:06:39 -08:00
|
|
|
}
|
2021-06-14 03:26:59 -07:00
|
|
|
|
|
|
|
_riverctl "$@"
|