10

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 .3/config:

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?

11

Try this instead:

xrandr | grep 'HDMI1 connected' &&
    xrandr --output eDP1 --auto --output HDMI1 --auto --left-of eDP1

That will run the xrandr command only if the HMDI1 screen is connected. I don't know the details of the format of .3/config (although I do know it will ignore anything after the exec line, are you sure you want this with exec?), so if that doesn't work just put it in a script and call the script from config.

  • Thanks, this did the trick for me: xrandr --output HDMI-1 --auto --left-of LVDS-1 – Matthias Braun Nov 14 '18 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.