This is a simple script I bound to ‘meta+F7’ to activate a second hdmi display I am using:
<pre lang="shell">
INTERNAL=eDP1
EXTERNAL=HDMI2
LOCK=/tmp/${EXTERNAL}.on
disper -l | grep $EXTERNAL
function on {
disper -e -d $INTERNAL,$EXTERNAL -r 1920x1080,1920x1080
touch $LOCK
}
function off {
disper -s -d $INTERNAL -r auto
rm -f $LOCK
}
if [ $? -eq 1 ]; then #there is no EXTERNAL, run single command
off
elif [ -f $LOCK ]; then
off
else
on
fi