home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / bash_completion.d / xrandr < prev    next >
Encoding:
Text File  |  2010-11-16  |  1.5 KB  |  53 lines

  1. # bash completion for xrandr
  2.  
  3. have xrandr &&
  4. _xrandr()
  5. {
  6.     local cur prev output modes
  7.     COMPREPLY=()
  8.     _get_comp_words_by_ref cur prev
  9.  
  10.     case $prev in
  11.         --output)
  12.             local outputs=$(xrandr|awk '/connected/ {print $1}')
  13.             COMPREPLY=( $(compgen -W "$outputs" -- "$cur"))
  14.             return 0
  15.             ;;
  16.         --mode)
  17.             for(( i = 1; i < COMP_CWORD; i++ )); do
  18.                 if [[ "${COMP_WORDS[i]}" == "--output" ]]; then
  19.                     output=${COMP_WORDS[i+1]}
  20.                     break
  21.                 fi
  22.             done
  23.             modes=$(xrandr|sed -e "1,/$output/ d" \
  24.                 -e "/connected/,$ d"|awk '{print $1}')
  25.             COMPREPLY=( $( compgen -W "$modes" -- "$cur"))
  26.             return 0
  27.             ;;
  28.     esac
  29.  
  30.     case $cur in
  31.         *)
  32.             COMPREPLY=( $(compgen -W '-display -help --orientation --query \
  33.                 --size --rate --version -x -y --screen --verbose --dryrun \
  34.                 --prop --fb --fbmm --dpi --output --auto --mode --preferred \
  35.                 --pos --reflect --rotate --left-of --right-of --above --below \
  36.                 --same-as --set --off --crtc --newmode --rmmode --addmode \
  37.                 --delmode' -- "$cur") )
  38.             return 0
  39.             ;;
  40.     esac
  41.  
  42.     return 0
  43. } &&
  44. complete -F _xrandr xrandr
  45.  
  46. # Local variables:
  47. # mode: shell-script
  48. # sh-basic-offset: 4
  49. # sh-indent-comment: t
  50. # indent-tabs-mode: nil
  51. # End:
  52. # ex: ts=4 sw=4 et filetype=sh
  53.