Advertisement
Guest User

.xprofile example

a guest
Oct 26th, 2010
598
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.45 KB | None | 0 0
  1. #!/bin/sh
  2. # If an external monitor is connected, place it with xrandr
  3. # Adapted from: http://www.thinkwiki.org/wiki/Xorg_RandR_1.2#Now_automate_it_on_login
  4.  
  5. ###### CHANGE THESE
  6.  
  7. # External output may be "VGA" or "VGA-0" or "DVI-0" or "TMDS-1"
  8. EXTERNAL_OUTPUT="VGA1"
  9. INTERNAL_OUTPUT="LVDS1"
  10. # Resolution for the external monitor
  11. EXTERNAL_RES="1920x1080"
  12. # EXTERNAL_LOCATION may be one of: left, right, above, or below
  13. EXTERNAL_LOCATION="right"
  14.  
  15. ###### DON'T CHANGE THESE
  16.  
  17. case "$EXTERNAL_LOCATION" in
  18.        left|LEFT)
  19.                EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
  20.                ;;
  21.        right|RIGHT)
  22.                EXTERNAL_LOCATION="--right-of $INTERNAL_OUTPUT"
  23.                ;;
  24.        top|TOP|above|ABOVE)
  25.                EXTERNAL_LOCATION="--above $INTERNAL_OUTPUT"
  26.                ;;
  27.        bottom|BOTTOM|below|BELOW)
  28.                EXTERNAL_LOCATION="--below $INTERNAL_OUTPUT"
  29.                ;;
  30.        *)
  31.                EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
  32.                ;;
  33. esac
  34.  
  35. xrandr |grep $EXTERNAL_OUTPUT | grep " connected "
  36. if [ $? -eq 0 ]; then
  37.     xrandr --output $INTERNAL_OUTPUT --off --output $EXTERNAL_OUTPUT --auto $EXTERNAL_LOCATION -s $EXTERNAL_RES
  38.     # Alternative command in case of trouble:
  39.     # (sleep 2; xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --auto $EXTERNAL_LOCATION) &
  40. else
  41.     xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --off
  42. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement