|
|
Thread Tools | Search this Thread | Display Modes |
10-10-2015, 03:29 AM | #1 |
Junior Member
Join Date: Oct 2015
Posts: 1
|
Debian 8.2 Jessie / Gnome - Autosetup with three screens
I put together this little collection of snippets to get around having to manually setup each time.
My laptop is a DELL XPS13 9343 running kernel 4.2.3 with Debian Jessie 8.2 and Gnome and my DELL D3100 is connected to three identical monitors. Perhaps it's of use to you. YMMV. No support given. /etc/udev/rules.d/20-displaylink-add.rules Code:
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="17e9", ATTRS{idProduct}=="436e" RUN+="/bin/systemctl start displaylink.service" Code:
ACTION=="remove", SUBSYSTEMS=="usb", ATTRS{idVendor}=="17e9", ATTRS{idProduct}=="436e" RUN+="/bin/sh -c '/bin/systemctl stop displaylink.service; /usr/bin/xrandr --output eDP1 --auto'" Code:
[Desktop Entry] Name=DisplayLink Setup GenericName=Auto setup of displaylink screens Comment=DisplayLink setup Exec=/bin/setup-displaylink-screens.sh auto Terminal=false Type=Application X-Gnome-Autostart=true Icon=device-display Code:
#!/bin/sh # --- info # # Original script developed by sipdude 2015-10-03 # # The sleep calls are necessary to prevent the X server from crashing. # Feel free to adjust as needed # --- settings for DELL XPS13 9343 with DELL D3100 connected to 3 monitors # D_CENTER connected to DP and D_LEFT and D_RIGHT to HDMI # D_LAPTOP=eDP1 D_LEFT=DVI-3-2 D_CENTER=DVI-1-0 D_RIGHT=DVI-2-1 # --- monitor mode and framerate # MODE=1920x1200 RATE=60 # --- functions # handle_rc() { local rc rc=$1 ; shift if [ $rc -eq 0 ] ; then echo " done!" else echo " fail!"; exit $rc fi } visual_sleep() { local esc pfx sec sec=$1 ; shift [ -n "$1" ] && pfx="$1" || pfx="Waiting: " esc="\033[2K\33[u" echo -n "\33[s" while [ $sec -gt 0 ] ; do echo -n "$esc$pfx$sec" sec=$((sec - 1)) sleep 1 done echo -n "$esc" } # --- service # [ -n "$1" -a x"$1" = "xauto" ] && AUTO=Y || AUTO=N [ -n "$DISPLAY" ] && X_DISPLAY=$DISPLAY || X_DISPLAY=":0" [ "$AUTO" = "Y" ] && echo "Running in automatic mode" || echo "Running in interactive mode" echo "Using X display: $X_DISPLAY" echo -n "Checking displaylink service:" if ! systemctl status displaylink.service | grep -q 'Active: active (running)' >/dev/null ; then echo " not started!" if [ "$AUTO" = "Y" ] ; then echo "Cannot start the displaylink service in automatic mode. Aborting!" exit fi echo "Attempting to start service..." sudo systemctl start displaylink.service rc=$? if [ $rc -eq 0 ] ; then echo "Successfully started displaylink service." else echo "Failed to start displaylink service!" exit fi visual_sleep 5 else echo " already started!" fi # --- inits # echo -n "Initializing outputs:" for outp in 1 2 3 ; do echo -n " $outp"; xrandr --setprovideroutputsource $outp 0 rc=$? if [ $rc -eq 0 ] ; then echo -n ":ok" ; else echo ":fail"; exit $rc; fi sleep 5 done echo # --- displays # for disp in $D_CENTER $D_LEFT $D_RIGHT ; do echo -n "Enabling display $disp:" xrandr --display $X_DISPLAY --output $disp --rate $RATE --mode $MODE handle_rc $? visual_sleep 10 done # --- positions # echo -n "Setting position for left display:" xrandr --display $X_DISPLAY --output $D_LEFT --left-of $D_CENTER handle_rc $? visual_sleep 10 echo -n "Setting position for right display:" xrandr --display $X_DISPLAY --output $D_RIGHT --right-of $D_CENTER handle_rc $? visual_sleep 10 # --- laptop # echo -n "Turning off laptop display:" xrandr --display $X_DISPLAY --output $D_LAPTOP --off handle_rc $? visual_sleep 10 echo "Finished!" exit 0 |
10-30-2015, 12:28 PM | #2 |
Junior Member
Join Date: Aug 2013
Posts: 2
|
Thanks
This was just what I needed - the udev rules really do the job in avoiding all the CLI tinkering.
Will have a closer look at the script to suit my environment. |
|
|