about summary refs log tree commit diff
path: root/Completion/X
diff options
context:
space:
mode:
authorPaul Seyfert <pseyfert.mathphys@gmail.com>2021-01-14 23:34:57 +0100
committerMatthew Martin <phy1729@gmail.com>2021-01-24 13:32:05 -0600
commit07765d590159f180a14af741dbe5639392093f0b (patch)
treeb11d66d094dfccef83a17fbf5d24b8853dd7082d /Completion/X
parentb374f7b31871358dc87ffcf3adfad099f7d5c6c8 (diff)
downloadzsh-07765d590159f180a14af741dbe5639392093f0b.tar.gz
zsh-07765d590159f180a14af741dbe5639392093f0b.tar.xz
zsh-07765d590159f180a14af741dbe5639392093f0b.zip
github #71: _xrandr: Complete providers
 * complete `xrandr --setprovideroutputsource` by calling `xrandr
   --listproviders`
Diffstat (limited to 'Completion/X')
-rw-r--r--Completion/X/Command/_xrandr10
1 files changed, 7 insertions, 3 deletions
diff --git a/Completion/X/Command/_xrandr b/Completion/X/Command/_xrandr
index 67045b33d..6143054aa 100644
--- a/Completion/X/Command/_xrandr
+++ b/Completion/X/Command/_xrandr
@@ -1,6 +1,6 @@
 #compdef xrandr
 
-local curcontext="$curcontext" state line expl
+local curcontext="$curcontext" state line expl state_descr
 typeset -A opt_args
 
 _arguments -C \
@@ -47,8 +47,8 @@ _arguments -C \
   "*--addmode:output:->outputs:name" \
   "*--delmode:output:->outputs:name" \
   '--listproviders' \
-  '--setprovideroutputsource:provider: :source' \
-  '--setprovideroffloadsink:provider: :sink' \
+  '--setprovideroutputsource:provider:->providers:source:->providers' \
+  '--setprovideroffloadsink:provider:->providers:sink:->providers' \
   '--listmonitors' \
   '--listactivemonitors' \
   '--setmonitor:name' \
@@ -75,4 +75,8 @@ case $state in
     _wanted modes expl mode compadd \
         ${(Mun)$(_call_program modes xrandr):#[0-9]##x[0-9]##} && return 0
   ;;
+  providers)
+    local -a xrandr_providers=(${(f)"$(_call_program providers xrandr --listproviders)"})
+    _wanted xrandr-providers expl $state_descr compadd ${${xrandr_providers}[2,-1]##*:} && return 0
+  ;;
 esac