How to enable auto-screen update on monitor plug-in/out on Lubuntu (Also, how can this be achieved in Ubuntu)?
It is probably a Gnome or Unity feature which is absent from LXDE. You could probably write a udev
rule to do this on monitor disconnect.
I have written a little script that will detect the monitors and extend accordingly:
#!/usr/bin/env bash
xrandr | grep VGA | grep -w connected >/dev/null
echo $?
if [[ "$?" -lt 1 ]]
then
notify-send "Extending desktop to VGA screen"
xrandr --output DP-3 --auto --output VGA-0 --auto --right-of DP-3 --primary
else
xrandr | grep DP-2 | grep connected >/dev/null
if [[ "$?" -gt 0 ]]
then
notify-send "Extending desktop to DisplayPort screen"
xrandr --output DP-3 --auto --output DP-2 --auto --right-of DP-3 --primary
else
notify-send "No known screens found"
fi
fi
You need to have xrandr
installed but you almost certainly do. You will also need to change the monitor names accordingly (in my case I switch between an external VGA and and external Display Port display). Run xrandr
with your external screen connected to getthe right name or update your question with the output of xrandr
and I can help you with it.
I have mapped this script to be run with a keyboard shortcut and simply run it whenever I connect or disconnect a screen.