mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-08 12:01:21 +02:00
30987: only call xrandr when necessary and use _call_program
This commit is contained in:
parent
0969fb91fa
commit
27c5a0d774
2 changed files with 34 additions and 23 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2013-01-20 Oliver Kiddle <opk@zsh.org>
|
||||||
|
|
||||||
|
* 30987: Completion/X/Command/_xrandr: only call xrandr when
|
||||||
|
necessary and use _call_program
|
||||||
|
|
||||||
2013-01-14 Peter Stephenson <p.stephenson@samsung.com>
|
2013-01-14 Peter Stephenson <p.stephenson@samsung.com>
|
||||||
|
|
||||||
* 30960: Alexey Bezhan: Completion/Unix/Command/_django:
|
* 30960: Alexey Bezhan: Completion/Unix/Command/_django:
|
||||||
|
@ -450,5 +455,5 @@
|
||||||
|
|
||||||
*****************************************************
|
*****************************************************
|
||||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||||
* $Revision: 1.5786 $
|
* $Revision: 1.5787 $
|
||||||
*****************************************************
|
*****************************************************
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
#compdef xrandr
|
#compdef xrandr
|
||||||
local context state line
|
|
||||||
|
local curcontext="$curcontext" state line expl
|
||||||
typeset -A opt_args
|
typeset -A opt_args
|
||||||
local outputs modes expl
|
|
||||||
|
|
||||||
# User configurable. TODO -- styles?
|
_arguments -C \
|
||||||
outputs=($(xrandr|sed -ne 's/^\([^[[:space:]]\+]*\) connected .*$/\1/p'))
|
|
||||||
modes=($(xrandr|sed -ne 's/^[[:space:]]\+\([[:digit:]]\+x[[:digit:]]\+\).*$/\1/p'|sort -nr|uniq))
|
|
||||||
|
|
||||||
_arguments \
|
|
||||||
'(-d -display)'{-d,-display}':X display:_x_display' \
|
'(-d -display)'{-d,-display}':X display:_x_display' \
|
||||||
'-help[display help]' \
|
'-help[display help]' \
|
||||||
'(-o --orientation)'{-o,--orientation}':rotation:(normal inverted left right 0 1 2 3)' \
|
'(-o --orientation)'{-o,--orientation}':rotation:(normal inverted left right 0 1 2 3)' \
|
||||||
|
@ -25,18 +21,18 @@ _arguments \
|
||||||
'--fb:size:' \
|
'--fb:size:' \
|
||||||
'--fbmm:size:' \
|
'--fbmm:size:' \
|
||||||
'--dpi:dpi:' \
|
'--dpi:dpi:' \
|
||||||
"*--output:output to reconfigure:($outputs)" \
|
"*--output:output to reconfigure:->outputs" \
|
||||||
'*--auto' \
|
'*--auto' \
|
||||||
"*--mode:mode:($modes)" \
|
"*--mode:mode:->modes" \
|
||||||
'*--preferred' \
|
'*--preferred' \
|
||||||
'*--pos:position:' \
|
'*--pos:position:' \
|
||||||
'*--reflect:axes:(normal x y xy)' \
|
'*--reflect:axes:(normal x y xy)' \
|
||||||
'*--rotate:rotation:(normal inverted left right)' \
|
'*--rotate:rotation:(normal inverted left right)' \
|
||||||
"*--left-of:relative position to:($outputs)" \
|
"*--left-of:relative position to:->outputs" \
|
||||||
"*--right-of:relative position to:($outputs)" \
|
"*--right-of:relative position to:->outputs" \
|
||||||
"*--above:relative position to:($outputs)" \
|
"*--above:relative position to:->outputs" \
|
||||||
"*--below:relative position to:($outputs)" \
|
"*--below:relative position to:->outputs" \
|
||||||
"*--same-as:relative position to:($outputs)" \
|
"*--same-as:relative position to:->outputs" \
|
||||||
'*--set:property:(Backlight scaling\ mode):value:->value' \
|
'*--set:property:(Backlight scaling\ mode):value:->value' \
|
||||||
'*--scale:output scaling:' \
|
'*--scale:output scaling:' \
|
||||||
'*--transform:transformation matrix:' \
|
'*--transform:transformation matrix:' \
|
||||||
|
@ -48,15 +44,25 @@ _arguments \
|
||||||
'--noprimary' \
|
'--noprimary' \
|
||||||
'*--newmode:name: :clock MHz: :hdisp: :hsync-start: :hsync-end: :htotal: :vdisp: :vsync-start: :vsync-end: :vtotal:' \
|
'*--newmode:name: :clock MHz: :hdisp: :hsync-start: :hsync-end: :htotal: :vdisp: :vsync-start: :vsync-end: :vtotal:' \
|
||||||
'*--rmmode:Mode name:' \
|
'*--rmmode:Mode name:' \
|
||||||
"*--addmode:output:($outputs):name:" \
|
"*--addmode:output:->outputs:name" \
|
||||||
"*--delmode:output:($outputs):name:" \
|
"*--delmode:output:->outputs:name" \
|
||||||
&& return 0
|
&& return 0
|
||||||
|
|
||||||
if [[ $state == value ]]; then
|
case $state in
|
||||||
|
value)
|
||||||
case $words[CURRENT-1] in
|
case $words[CURRENT-1] in
|
||||||
(scaling* mode)
|
(scaling* mode)
|
||||||
_description value expl "output property 'scaling mode'"
|
_description value expl "output property 'scaling mode'"
|
||||||
compadd "$@" "$expl[@]" None Full Center Full\ aspect && return 0
|
compadd "$@" "$expl[@]" None Full Center Full\ aspect && return 0
|
||||||
;;
|
;;
|
||||||
esac
|
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
|
||||||
|
|
Loading…
Reference in a new issue