From cf00fb2ccc2063fbbd5b72e0d3b8e75697243c3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9ouven=20Assouly?= Date: Tue, 1 Jan 2019 16:16:11 +0100 Subject: [PATCH] zsh: update completions --- completions/zsh/_sway | 4 ++-- completions/zsh/_swaybar | 13 +++++++++++++ completions/zsh/_swayidle | 22 +++++++++++++++++++++ completions/zsh/_swaylock | 40 ++++++++++++++++++++++++++++++++------- completions/zsh/_swaymsg | 12 +++++++----- 5 files changed, 77 insertions(+), 14 deletions(-) create mode 100644 completions/zsh/_swaybar create mode 100644 completions/zsh/_swayidle diff --git a/completions/zsh/_sway b/completions/zsh/_sway index 05112002..a7f55cc5 100644 --- a/completions/zsh/_sway +++ b/completions/zsh/_sway @@ -13,8 +13,8 @@ # # ------------------------------- _arguments -s \ - '(-v --version)'{-v,--version}'[shows version]' \ - '(-h --help)'{-h,--help}'[shows help message]' \ + '(-v --version)'{-v,--version}'[Show the version number and quit]' \ + '(-h --help)'{-h,--help}'[Show help message and quit]' \ '(-c --config)'{-c,--config}'[Specify a config file]:files:_files' \ '(-C --validate)'{-C,--validate}'[Check validity of the config file, then exit]' \ '(-d --debug)'{-d,--debug}'[Enables full logging, including debug information]' \ diff --git a/completions/zsh/_swaybar b/completions/zsh/_swaybar new file mode 100644 index 00000000..4fdfdd8a --- /dev/null +++ b/completions/zsh/_swaybar @@ -0,0 +1,13 @@ +#compdef swaybar +# +# Completion script for swaybar +# + +local bars=($(swaymsg -t get_bar_config | sed -e '/^\[/,/\]$/{//d;s/^ *"\(.*\)",\?.*$/\1/}')) + +_arguments -s \ + '(-h --help)'{-h,--help}'[Show help message and quit]' \ + '(-v --version)'{-v,--version}'[Show version and quit]' \ + '(-s --socket)'{-s,--socket}'[Connect to sway via socket]:filename:_files' \ + '(-b --bar_id)'{-b,--bar-id}'[Bar ID for which to get the configuration]:filename:($bars)'\ + '(-d --debug)'{-d,--debug}'[Enable debugging]' diff --git a/completions/zsh/_swayidle b/completions/zsh/_swayidle new file mode 100644 index 00000000..b419bc2c --- /dev/null +++ b/completions/zsh/_swayidle @@ -0,0 +1,22 @@ +#compdef swayidle +# +# Completion script for swayidle +# + +local events=('timeout:Execute timeout command if there is no activity for timeout seconds' + 'before-sleep:Execute before-sleep command before sleep') +local resume=('resume:Execute command when there is activity again') + +if (($#words <= 2)); then + _arguments -C \ + '(-h --help)'{-h,--help}'[Show help message and quit]' \ + '(-d)'-d'[Enable debug output]' + _describe -t "events" 'swayidle' events + +elif [[ "$words[-3]" == before-sleep || "$words[-3]" == resume ]]; then + _describe -t "events" 'swayidle' events + +elif [[ "$words[-4]" == timeout ]]; then + _describe -t "events" 'swayidle' events + _describe -t "resume" 'swayidle' resume +fi diff --git a/completions/zsh/_swaylock b/completions/zsh/_swaylock index 8fb4834c..9bc84ec9 100644 --- a/completions/zsh/_swaylock +++ b/completions/zsh/_swaylock @@ -4,11 +4,37 @@ # _arguments -s \ - '(-v --version)'{-v,--version}'[Show the version number and quit]' \ - '(-h --help)'{-h,--help}'[Show help message and quit]' \ - '(-f --daemonize)'{-f,--daemonize}'[Detach from the controlling terminal]' \ - '(-c --color)'{-c,--color}'[Specify a color (rrggbb)]' \ - '(-i --image)'{-i,--image}'[Display an image]:files:_files' \ - '(-s --scaling)'{-s,--scaling}'[Scaling mode]:mode:(stretch fill fit center tile)' \ + '(-C --config)'{-C,--config}'[Path to the config file]:filename:_files' \ + '(-c --color)'{-c,--color}'[Turn the screen into the given color instead of white]:color:' \ + '(-e --ignore-empty-password)'{-e,--ignore-empty-password}'[When an empty password is provided, do not validate it]' \ + '(-f --daemonize)'{-f,--daemonize}'[Detach from the controlling terminal after locking]' \ + '(-h --help)'{-h,--help}'[Show help message and quit]' \ + '(-i --image)'{-i,--image}'[Display an image]:filename:_files' \ + '(-s --scaling)'{-s,--scaling}'[Scaling mode]:mode:(stretch fill fit center tile)' \ + '(-t --tiling)'{-t,--tiling}'[Same as --scaling=tile]' \ '(-u --no-unlock-indicator)'{-u,--no-unlock-indicator}'[Disable the unlock indicator]' \ - '(--socket)'--socket'[Use the specified socket path.]:files:_files' \ + '(-v --version)'{-v,--version}'[Show the version number and quit]' \ + '(--bs-hl-color)'--bs-hl-color'[Sets the color of backspace highlights segments]:color:' \ + '(--font)'--font'[Sets the font of the text]:font:' \ + '(--indicator-radius)'--indicator-radius'[Sets the indicator radius]:radius:' \ + '(--indicator-thickness)'--indicator-thickness'[Sets the indicator thickness]:thickness:' \ + '(--inside-color)'--inside-color'[Sets the color of the inside of the indicator]:color:' \ + '(--inside-clear-color)'--inside-clear-color'[Sets the color of the inside of the indicator when cleared]:color:' \ + '(--inside-clear-color)'--inside-clear-color'[Sets the color of the inside of the indicator when verifying]:color:' \ + '(--inside-wrong-color)'--inside-wrong-color'[Sets the color of the inside of the indicator when invalid]:color:' \ + '(--key-hl-color)'--key-hl-color'[Sets the color of the key press highlight segments]:color:' \ + '(--line-color)'--line-color'[Sets the color of the line between the inside and ring]:color:' \ + '(--line-clear-color)'--line-clear-color'[Sets the color of the line between the inside and ring when cleared]:color:' \ + '(--line-ver-color)'--line-ver-color'[Sets the color of the line between the inside and ring when verifying]:color:' \ + '(--line-wrong-color)'--line-wrong-color'[Sets the color of the line between the inside and ring when invalid]:color:' \ + '(-n --line-uses-inside)'{-n,--line-uses-inside}'[Use the inside color for the line between the inside and ring]' \ + '(-r --line-uses-ring)'{-r,--line--uses-ring}'[Use the ring color for the line between the inside and ring]' \ + '(--ring-color)'--ring-color'[Sets the color of the ring of the indicator]:color:' \ + '(--ring-clear-color)'--ring-clear-color'[Sets the color of the ring of the indicator when cleared]:color:' \ + '(--ring-ver-color)'--ring-ver-color'[Sets the color of the ring of the indicator when verifying]:color:' \ + '(--ring-wrong-color)'--ring-wrong-color'[Sets the color of the ring of the indicator when invalid]:color:' \ + '(--separator-color)'--separator-color'[Sets the color of the lines that separate highlight segments]:color:' \ + '(--text-color)'--text-color'[Sets the color of the text]:color:' \ + '(--text-clear-color)'--text-clear-color'[Sets the color of the text when cleared]:color:' \ + '(--text-ver-color)'--text-ver-color'[Sets the color of the text when verifying]:color:' \ + '(--text-wrong-color)'--text-wrong-color'[Sets the color of the text when invalid]:color:' \ No newline at end of file diff --git a/completions/zsh/_swaymsg b/completions/zsh/_swaymsg index a7a1c8e0..0ba45d4a 100644 --- a/completions/zsh/_swaymsg +++ b/completions/zsh/_swaymsg @@ -28,8 +28,10 @@ types=( ) _arguments -s \ - '(-v --version)'{-v,--version}'[Print the version (of swaymsg) and quit]' \ - '(-h --help)'{-h,--help}'[Shows help message]' \ - '(-q --quiet)'{-q,--quiet}'[Sends the IPC message but does not print the response from sway]' \ - '(-s --socket)'{-s,--socket}'[Use the specified socket path.]:files:_files' \ - '(-t --type)'{-t,--type}'[Specify the type of IPC message.]:type:{_describe "type" types}' + '(-v --version)'{-v,--version}'[Show the version number and quit]' \ + '(-m --monitor)'{-m,--monitor}'[Monitor until killed (-t SUBSCRIBE only)]' \ + '(-h --help)'{-h,--help}'[Show help message and quit]' \ + '(-q --quiet)'{-q,--quiet}'[Be quiet]' \ + '(-r --raw)'{-r,--raw}'[Use raw output even if using a tty]' \ + '(-s --socket)'{-s,--socket}'[Use the specified socket path]:files:_files' \ + '(-t --type)'{-t,--type}'[Specify the message type]:type:{_describe "type" types}'