i3 for dual-monitor on laptop

25,970

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.

Share:
25,970

Related videos on Youtube

danielspaniol
Author by

danielspaniol

Updated on September 18, 2022

Comments

  • danielspaniol
    danielspaniol over 1 year

    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?

  • Dhinesh.B
    Dhinesh.B over 5 years
    Thanks, this did the trick for me: xrandr --output HDMI-1 --auto --left-of LVDS-1