I am on the latest Ubuntu 14.04 with GNOME-3 (not Ubuntu Unity). In my office, I am using Lenovo T410 laptop with an external monitor connected to it via docking station.
What I want is to use ONLY the external monitor whenever the laptop is attached to the docking station.
I can easily achieve this manually with xrandr or with the GUI tool (Displays). They both detect the monitor and work fine. But I want to do it automatically.
I managed to do it on lightdm level. I put this into /etc/lightdm/lightdm.conf:
And here is lightdmxrandr.sh (here: LVDS-1 is the laptop screen, DP-3 is the monitor):
#!/bin/bash XCOM0=`xrandr -q | grep 'DP-3 connected'` if [ -n "$XCOM0" ] || [ ! "$XCOM0" = "" ] then # external monitor is connected xrandr --output LVDS-1 --off --output DP-3 --primary --auto else # external monitor is disconnected xrandr --output LVDS-1 --primary --auto fi exit 0;
This works well on lightdm level, the laptop screen is disabled whenever I have my monitor attached.
But when I enter my username/password, the laptop screen is suddenly enabled, extending the monitor. I can't figure out what enables it. Looks like some default setting in GNOME.
How can I prevent GNOME from doing this?