From: Vincent Bernat Date: Fri, 31 Jan 2020 07:34:51 +0000 (+0100) Subject: contrib: zsh completion X-Git-Tag: 1.10~10 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=08d9b4f72d8e3ff0aee64c1004beea88fb5ce004;p=deb_pkgs%2Fautorandr.git contrib: zsh completion --- diff --git a/contrib/zsh_completion/_autorandr b/contrib/zsh_completion/_autorandr new file mode 100644 index 0000000..96e7f7b --- /dev/null +++ b/contrib/zsh_completion/_autorandr @@ -0,0 +1,40 @@ +#compdef autorandr + +__autorandr_profile () { + declare -a virtual + virtual=("off":"disable all outputs" + "common":"clone at the largest common resolution" + "clone-largest":"clone with the largest resolution" + "horizontal":"stack all connected outputs horizontally" + "vertical":"stack all connected outputs vertically") + _describe -t virtual-profiles "virtual profiles" virtual + __autorandr_saved_profile +} +__autorandr_saved_profile () { + declare -a saved + saved=(${${(f)${:-$(autorandr)}}/ /:}) + _describe -t profiles "saved profiles" saved +} + +_autorandr () { + local curcontext="$curcontext" state line exclude="-s --save -l --load -r --remove -c --change" + + _arguments -C \ + "(: -)"{-h,--help}"[get help]" \ + "($exclude)"{-c,--change}"[automatically load the first detected profile]" \ + "($exclude)"{-d,--default}"[set default profile]:profile:__autorandr_profile" \ + "($exclude)"{-l,--load}"[load profile]:profile:__autorandr_profile" \ + "($exclude)"{-s,--save}"[save current setup to a profile]:profile: " \ + "($exclude)"{-r,--remove}"[remove profile]:profile:__autorandr_saved_profile" \ + --batch"[run autorandr for all users]" \ + --current"[list current active configurations]" \ + --config"[dump current xrandr setup]" \ + --debug"[enable verbose output]" \ + --dry-run"[don't change anything]" \ + --fingerprint"[fingerprint current hardware]" \ + --force"[force loading of a profile]" \ + --skip-options"[skip xrandr options]:xrandr options:_values -s , options gamma brightness panning transform primary mode pos rate" \ + --version"[show version]" +} + +_autorandr "$@"