diff --git a/bash_completion b/bash_completion index e3c9604c..eaa0c512 100644 --- a/bash_completion +++ b/bash_completion @@ -5698,6 +5698,56 @@ _ypmatch() } && complete -F _ypmatch ypmatch ypcat +#xrandr(1) completion +# +have xrandr && +_xrandr() +{ + local cur prev output modes + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + --output) + local outputs=$(xrandr|grep 'connected'|awk '{print $1}') + COMPREPLY=( $(compgen -W "$outputs" -- $cur)) + return 0 + ;; + --mode) + for(( i = 1; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" == "--output" ]]; then + output=${COMP_WORDS[i+1]} + break + fi + done + modes=$(xrandr|sed -e "1,/$output/ d" \ + -e "/connected/,$ d"|awk '{print $1}') + COMPREPLY=( $( compgen -W "$modes" -- $cur)) + return 0 + ;; + esac + + case "$cur" in + *) + COMPREPLY=( $(compgen -W '-d -display -help -o \ + --orientation -q --query -s --size\ + -r --rate -v --version -x -y --screen \ + --verbose --dryrun --prop --fb --fbmm --dpi \ + --output --auto --mode --preferred --pos \ + --reflect --rotate --left-of --right-of \ + --above --below --same-as --set --off --crtc \ + --newmode --rmmode --addmode --delmode' -- $cur)) + return 0 + ;; + esac + + return 0 +} && +complete -F _xrandr xrandr + + + # mplayer(1) completion # have mplayer && { diff --git a/debian/changelog b/debian/changelog index 3b5e4dbb..3761e52e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,10 @@ -bash-completion (20080624) experimental; urgency=low +bash-completion (20080624) UNRELEASED; urgency=low * Added more completions to imagemagick (thanks to Nelson A. de Oliveira) (Closes: #487786) + * Added xrandr completion (thanks to Anton Khirnov) (Closes: #487825) - -- David Paleino Tue, 24 Jun 2008 21:41:48 +0200 + -- David Paleino Tue, 24 Jun 2008 21:44:15 +0200 bash-completion (20080617.4) experimental; urgency=low