summaryrefslogtreecommitdiff
path: root/localxrandr
blob: fd78245b5d715ee95482201dd18eaa921065b7dd (plain)
  1. #!/bin/sh
  2. #
  3. # /usr/local/bin/localwebgalleryupdate
  4. # Copyright 2009-2010 Jonas Smedegaard <dr@jones.dk>
  5. #
  6. # Autoconfigure Xorg to use all currently connected monitors
  7. #
  8. xinerama=1
  9. lcd=
  10. vga=
  11. dvi=
  12. tv=
  13. for output in $(xrandr | egrep '^[^ ]+ connected' | awk '{print $1}'); do
  14. case $output in
  15. LVDS|LVDS1|LVDS-1)
  16. lcd="$output"
  17. ;;
  18. VGA|VGA1)
  19. vga="$output"
  20. ;;
  21. TMDS-1|DVI1|DVI-I-1)
  22. dvi="$output"
  23. ;;
  24. TV)
  25. tv="$output"
  26. ;;
  27. *)
  28. echo "Unknown output \"$output\""
  29. ;;
  30. esac
  31. done
  32. if [ -n "$lcd" ] && [ -n "$dvi" ]; then
  33. if [ -n "$xinerama" ]; then
  34. xrandr \
  35. --output "$lcd" --mode 1280x800 --rotate normal \
  36. --output "$dvi" --mode 1680x1050 --rotate normal --left-of $lcd --preferred
  37. # xrandr \
  38. # --output "$lcd" --mode 1280x800 --rotate left \
  39. # --output "$dvi" --mode 1680x1050 --rotate left --right-of $lcd
  40. else
  41. xrandr --output "$dvi" --mode 1280x800
  42. fi
  43. elif [ -n "$vga" ]; then
  44. xrandr --output "$vga" --mode 1680x1050
  45. else
  46. xrandr --auto
  47. fi
  48. ## Mirrored screen, needs virtual screen min 1680x1050
  49. # xrandr --output TMDS-1 --mode 1680x1050
  50. ## Mirrored screen matching internal screen, needs virtual screen min 1280x800
  51. # xrandr --output TMDS-1 --mode 1280x800
  52. ## Xinerama horisontal (low-res), needs virtual screen min 1920x768
  53. # xrandr --output LVDS --mode 640x480
  54. # xrandr --output TMDS-1 --right-of LVDS --mode 1280x768
  55. ## Xinerama horisontal, needs virtual screen min 1680x1850
  56. # xrandr --output LVDS --mode 1280x800
  57. # xrandr --output TMDS-1 --above LVDS --mode 1680x1050
  58. #else
  59. # xrandr --auto
  60. #fi