diff options
Diffstat (limited to 'Completion/X/Command')
-rw-r--r-- | Completion/X/Command/_mplayer | 4 | ||||
-rw-r--r-- | Completion/X/Command/_xrandr | 50 |
2 files changed, 30 insertions, 24 deletions
diff --git a/Completion/X/Command/_mplayer b/Completion/X/Command/_mplayer index 81669fc1c..eaf6e84bc 100644 --- a/Completion/X/Command/_mplayer +++ b/Completion/X/Command/_mplayer @@ -114,8 +114,8 @@ case "$state" in mfiles) _tags files urls while _tags; do - _requested files expl 'video file' _files -g \ - "*.(#i)(asf|asx|avi|flac|flv|m1v|m2p|m2v|m4v|mjpg|mka|mkv|mov|mp3|mp4|mpe|mpeg|mpg|ogg|ogm|qt|rm|vob|wav|webm|wma|wmv)(-.)" && ret=0 + _requested files expl 'media file' _files -g \ + "*.(#i)(asf|asx|avi|flac|flv|m1v|m2p|m2v|m4v|mjpg|mka|mkv|mov|mp3|mp4|mpe|mpeg|mpg|ogg|ogm|ogv|qt|rm|ts|vob|wav|webm|wma|wmv)(-.)" && ret=0 if _requested urls; then while _next_label urls expl URL; do _urls "$expl[@]" && ret=0 diff --git a/Completion/X/Command/_xrandr b/Completion/X/Command/_xrandr index 2e51d0d23..9d9323c69 100644 --- a/Completion/X/Command/_xrandr +++ b/Completion/X/Command/_xrandr @@ -1,13 +1,9 @@ #compdef xrandr -local context state line -typeset -A opt_args -local outputs modes expl -# User configurable. TODO -- styles? -outputs=(LVDS1 TV1 VGA1) -modes=(1280x800 1024x768 800x600 640x480) +local curcontext="$curcontext" state line expl +typeset -A opt_args -_arguments \ +_arguments -C \ '(-d -display)'{-d,-display}':X display:_x_display' \ '-help[display help]' \ '(-o --orientation)'{-o,--orientation}':rotation:(normal inverted left right 0 1 2 3)' \ @@ -25,18 +21,18 @@ _arguments \ '--fb:size:' \ '--fbmm:size:' \ '--dpi:dpi:' \ - "*--output:output to reconfigure:($outputs)" \ + "*--output:output to reconfigure:->outputs" \ '*--auto' \ - "*--mode:mode:($modes)" \ + "*--mode:mode:->modes" \ '*--preferred' \ '*--pos:position:' \ '*--reflect:axes:(normal x y xy)' \ '*--rotate:rotation:(normal inverted left right)' \ - "*--left-of:relative position to:($outputs)" \ - "*--right-of:relative position to:($outputs)" \ - "*--above:relative position to:($outputs)" \ - "*--below:relative position to:($outputs)" \ - "*--same-as:relative position to:($outputs)" \ + "*--left-of:relative position to:->outputs" \ + "*--right-of:relative position to:->outputs" \ + "*--above:relative position to:->outputs" \ + "*--below:relative position to:->outputs" \ + "*--same-as:relative position to:->outputs" \ '*--set:property:(Backlight scaling\ mode):value:->value' \ '*--scale:output scaling:' \ '*--transform:transformation matrix:' \ @@ -48,15 +44,25 @@ _arguments \ '--noprimary' \ '*--newmode:name: :clock MHz: :hdisp: :hsync-start: :hsync-end: :htotal: :vdisp: :vsync-start: :vsync-end: :vtotal:' \ '*--rmmode:Mode name:' \ - "*--addmode:output:($outputs):name:" \ - "*--delmode:output:($outputs):name:" \ + "*--addmode:output:->outputs:name" \ + "*--delmode:output:->outputs:name" \ && return 0 -if [[ $state == value ]]; then +case $state in + value) case $words[CURRENT-1] in - (scaling* mode) - _description value expl "output property 'scaling mode'" - compadd "$@" "$expl[@]" None Full Center Full\ aspect && return 0 - ;; + (scaling* mode) + _description value expl "output property 'scaling mode'" + compadd "$@" "$expl[@]" None Full Center Full\ aspect && return 0 + ;; esac -fi + ;; + outputs) + _wanted outputs expl output compadd \ + ${(uo)${(M)${(f)"$(_call_program outputs xrandr)"}:#* connected*}%% *} && return 0 + ;; + modes) + _wanted modes expl mode compadd \ + ${(Mun)$(_call_program modes xrandr):#[0-9]##x[0-9]##} && return 0 + ;; +esac |