Gentoo installation script
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

srandr 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env sh
  2. ## Example ~/.display.sh Configuration
  3. #
  4. # #!/usr/bin/env sh
  5. # DisplayConfigs="LVDS1 VGA1"
  6. # LVDS1() {
  7. # xrandr --output LVDS1 --auto
  8. # }
  9. # VGA1() {
  10. # xrandr --output VGA1 --auto --above LVDS1
  11. # }
  12. Displays=""
  13. while :; do
  14. if [[ $DISPLAY ]]; then
  15. CDisplays=$(xrandr | grep ' connected' | awk '{print $1}')
  16. DDisplays=$(xrandr | grep 'disconnected' | awk '{print $1}')
  17. if [ "$Displays" != "$CDisplays" ]; then
  18. for display in $CDisplays; do
  19. if [ -e "$HOME/.display.sh" ]; then
  20. . "$HOME/.display.sh"
  21. for config in $DisplayConfigs; do
  22. if [ "$display" == "$config" ]; then
  23. $config
  24. fi
  25. done
  26. else
  27. xrandr --output "$display" --auto
  28. fi
  29. done
  30. for display in $DDisplays; do
  31. xrandr --output "$display" --off
  32. done
  33. Displays="$Connected"
  34. fi
  35. fi
  36. sleep 5
  37. done