Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Changes to xrandr completion



Kovacsics Robert <kovirobi@xxxxxxxxx> writes:

> Hi!
> I would like to add the changes in the patch file for a smarter xrandr
> completion.
> Thank you,
> Robert Kovacsics
>
> --- a/zsh-5.0.2/Completion/X/Command/_xrandr	2011-01-08 20:24:47.000000000 +0000
> +++ b/zsh-5.0.2/Completion/X/Command/_xrandr	2013-01-05 19:09:53.564221743 +0000
> @@ -4,8 +4,8 @@
>  local outputs modes expl
>  
>  # User configurable. TODO -- styles?
> -outputs=(LVDS1 TV1 VGA1)
> -modes=(1280x800 1024x768 800x600 640x480)
> +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' \

Hah, I wanted to do something similar.  I'd propose to make it a
"zstyle -e" by default.

Also, you can use
${(uo)${(M)${(f)"$(xrandr)"}:#* connected*}%% *}
and
${(Mun)$(xrandr):#[0-9]##x[0-9]##}

-- 
Christian Neukirchen  <chneukirchen@xxxxxxxxx>  http://chneukirchen.org



Messages sorted by: Reverse Date, Date, Thread, Author