This little script will help you to understand how to use xrandr to enable, disable and configure your second Display via bash:
#!/bin/bash FIRST="HDMI-0" SECOND="DVI-0" BASECMD="xrandr --auto --output $SECOND" MODE="--mode 1920x1080" DIRECTION="--right-of $FIRST" ROTATE="--rotate left" OFF="--off" function off() { $BASECMD $OFF } function on() { $BASECMD $MODE $DIRECTION $ROTATE } function usage() { echo "usage: $(basename $0) on|off" } case "$1" in on) on ;; off) off ;; *) usage ;; esac
Enjoy! 🙂