Hi stuguy909,
Currently, I made a little script that I launch manually as root after connecting my device.
filename : connect_screen.sh
Code:
#!/bin/sh
if [ $(id -u) != 0 ]; then
echo "You need to be root to use this script." >&2
exit 1
fi
REFER_SCREEN="LVDS1"
NEW_SCREEN="DVI-1-0"
POSITION="left"
echo "Loading displaylink service..."
systemctl start displaylink.service
echo "Screen connection..."
sleep 2
xrandr --setprovideroutputsource 1 0
sleep 2
echo "Available screen : "
xrandr | grep connected | grep -v disconnected | cut -d' ' -f1
echo "They can be used with option -r to specify the referer screen"
echo "They can be used with option -n to specify the new screen"
echo "The position (left, right) can be specified with option -p"
echo "..."
while getopts :sr:n:p: OPTION
do
case "$OPTION" in
s)
exit 1
;;
r)
REFER_SCREEN="$OPTARG"
;;
n)
NEW_SCREEN="$OPTARG"
;;
p)
POSITION="$OPTARG"
;;
:)
echo "$OPTARG need an argument"
exit 5
;;
\?)
echo "Incorrect option... "
exit 3
;;
esac
done
echo "Place the displaylink screen $NEW_SCREEN at $POSITION of the screen $REFER_SCREEN."
sleep 2
xrandr --output $NEW_SCREEN --auto --$POSITION-of $REFER_SCREEN
echo "Install complete. You can adjust your configuration in the settings panel."
To display available screen, you can use it with -s option
Code:
# ./connect_screen.sh -s
Loading displaylink service...
Screen connection...
Available screen :
LVDS1
DVI-1-0
They can be used with option -r to specify the referer screen
They can be used with option -n to specify the new screen
The position (left, right) can be specified with option -p
...
The screen LVDS1 is generally the main screen... In my case, the DVI-1-0 is my HP Elite Display.
So, to place the screen DVI-1-0 on the right of LVSD1, you have to use the script like :
Code:
# ./connect_screen.sh -n DVI-1-0 -p right -r LVDS1
Loading displaylink service...
Screen connection...
Available screen :
LVDS1
DVI-1-0
They can be used with option -r to specify the referer screen
They can be used with option -n to specify the new screen
The position (left, right) can be specified with option -p
...
Place the displaylink screen DVI-1-0 at right of the screen LVDS1.
Install complete. You can adjust your configuration in the settings panel.
Option's order is not important...
I will add it into my installer and copy it to /sbin to be used by root.
You should found some helpful command into this script. I hope that this can help you ;-)
To the automation, I think that UDEV could do what we need but I have not found the correct rule yet...