Automatically revert to laptop screen when external monitor unplugged
- by Ryan
I regularly use an external monitor with my laptop, so when I use it, I usually have the laptop screen disabled when the monitor is connected, and this seems to cause problems when the monitor is disconnected. If the monitor is connected while the laptop screen is disabled, I can't get the X session to show up at all:
I can Ctrl+Alt+F1 to open a terminal, and that works fine..
..but Ctrl+Alt+F7 does nothing. The display is blank, and stays blank. The same thing happens whether I put the computer to sleep with the monitor connected, or if I disconnect while the computer is still awake.
Rebooting the computer fixes the issue, as does killing Xorg and starting it again, but both of those are sub-optimal since I lose my current session. I'm currently using the open source graphics driver (xserver-xorg-video-ati).
This question looks like it might answer my question, but unfortunately hwinfo is no longer available in the apt repository.
Is there a way with current tools to automatically detect when the external monitor is disconnected and switch to the laptop display?