Auto-detect monitor unplug
I know of no clean way to detect an unplugged screen, so I figured I’d force re-detection with a cron job.
To detect the monitors I’m using disper, you can get it from the Wheezy and Sid repositories.
Let’s open up our crontab.
crontab -e If you’re doing this for other users too, you may use
sudo crontab -eu username Now add a new entry:
0-59 * * * * DISPLAY=:0.0 disper -ld auto > /dev/null This will automatically detect (-d auto) and list (-l) all monitors every minute.
Of course, you can also use xrandr:
0-59 * * * * DISPLAY=:0.