#!/bin/bash

# Per host overrides
SPECIFIC=~/bin/dualscreen.$HOSTNAME.sh
[ -x "$SPECIFIC" ] && echo $SPECIFIC && exec $SPECIFIC "$@"

# See history for old host-specific setup
# Solve that with dualscreen.$HOSTNAME scripts

PORT=$2
[ -z "$PORT" ] && PORT=$(displays.sh | grep -v LVDS | head -n 1)

if [ -z "$PORT" ]; then
    echo no second display found
    exit 1
fi

echo $PORT $1


case $1 in
    off)
        xrandr --output $PORT --off
        ;;
    *)
        xrandr --output $PORT --auto
        xrandr --output $PORT --auto --left-of LVDS-1
        ;;
esac


xmodmap ~/dot/Xmodmap.ctrl

