I have a multi-monitor setup where I want to use *either* my laptop screen *or* my external monitor. I've set up an "autoxrandr" script like this, to enable an external monitor if it's connected, and to enable the laptop panel otherwise:
#!/bin/bash for output in $(xrandr | grep '\Wconnected' | awk '{ print $1 }'); do if [[ ! $output =~ ^LVDS.*$ ]]; then other=$output fi done if [ "$other" != "" ] ; then xrandr --output $other --auto --primary --output LVDS1 --off else xrandr --output LVDS1 --auto --primary fi The trouble is that when the laptop is connected to an external screen, and when I turn the monitor off, it seems that i3 exits. What I want instead is that it either keeps running so that I can switch the laptop screen on, or that I can configure it to automatically turn the laptop screen on. I have no clue where to debug this. This is on Ubuntu 14.04 and using lightdm. The lightdm logs say that the session (i3) exits and that's why its stopping the session. I don't think I can get i3 logs using the instructions at http://i3wm.org/docs/debugging.html because both i3 and the X session are dead after this happens. Any idea what I could try here?