I am using i3 as the window manager on my laptop. Now I want it to work with my HDMI monitor. So far I have this is my
exec xrandr --output eDP1 --auto --output HDMI1 --auto --left-of eDP1
This works quite well but only as long as my HDMI monitor is plugged in. When it is not I have half of my workspaces not visible since they are not displayed on my laptops monitor.
How can I make it detect whether or not the other monitor is plugged in and have a configuration for both cases?
Also can it automatically detect when the HDMI is (un)plugged and change the configursation accordingly? Or do I have to bind it to a key to check for monitors?