Added xrandr completion (thanks to Anton Khirnov) (Closes: #487825)

This commit is contained in:
David Paleino 2008-06-24 21:44:51 +02:00
parent 0bd98785eb
commit 18e2abf30c
2 changed files with 53 additions and 2 deletions

View File

@ -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 && {

5
debian/changelog vendored
View File

@ -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 <d.paleino@gmail.com> Tue, 24 Jun 2008 21:41:48 +0200
-- David Paleino <d.paleino@gmail.com> Tue, 24 Jun 2008 21:44:15 +0200
bash-completion (20080617.4) experimental; urgency=low