Detect and enable external monitor in i3

I am using Manjaro i3 community edition.

When I plug in my external monitor, if I am already in a working session I need to reboot my computer for the external monitor to be detected. In other words, the external monitor needs to be connected when I boot my computer. Is there a way to fix this?

Do you try
mod+shift+r
or
mod+shift+c
?

Yes, doesn't work :frowning:

Assuming you have xorg-xrandr installed, what happens if you run xrandr --auto after you plug in your external monitor?

Also, the Arch Wiki describes how to create a new mode for manual management of external displays:
https://wiki.archlinux.org/index.php/I3#External_displays_manual_management

You can give it a try if you haven't already.

3 Likes

Oh! I can't believe I didn't try that before. It switches on the external monitor, but it duplicates my primary monitor (ignores my i3 config, even after mod+shift+r)

I never run dual monitors, so I'm not the one to ask for advice. However, I'm pretty sure this topic and solution has been posted before. Search the forum and you'll probably find your answer.

2 Likes

My solution to this problem was to create a script as described here:


Then you can bind this script to a keyboard shortcut. So you can run it even after just having plugged in or out your external monitor. Then you don't have to reboot each time. As described on the linked website you may have to adjust the script line to your needs in terms of using your output of your setup. You can find out your output variable (which is your external/internal monitor) by typing the following in a terminal:

xrandr -q

The command reported from the linked website

xrandr -q | grep 'VGA connected' && xrandr --output LVDS --off --output VGA --auto

works, if VGA is your external monitor and LVDS the internal monitor. In this setup, the internal monitor gets switched off, if the external monitor is detected.

Hope that helps.

z0id

2 Likes

xrandr -o normal works most of the time. Sometimes it crashes my display (turns on and off rapidly - with no display).

Is there a way to remember the previous arrangement of workspaces across the different displays (but only to be recorded from this session - if it is a new session, then it works like it does now)?

You could use this command:

xrandr --output LVDS --auto --output VGA --auto --right-of LVDS1

In this scenario your external monitor (VGA) extends the internal monitor (LVDS) to the right.

With

xrandr --query

you can find out the name of your external/internal monitor (VGA vs. LVDS etc.). Running the command once with the external monitor plugged in and plugged out lets you detect which one it is.

Has something worked out for you? Could you solve the problem?

No, using the xrandr to set the absolute position of monitors does not work.

No, I havn't found a suitable solution yet.

So, using arandr, activating the particular display manually, and then arranging the screens worked.

Helpful tip for anyone who wants to do this - save the arandr setup -> arandr saves it as a xrandr command in .sh script. Next time just use the script to arrange your display after plugging in an external monitor :slight_smile:

TLDR; it needed an xrandr command to work, but it was hard to figure out what it was since the startup command to arrange displays did not work.

Forum kindly sponsored by