Dual Monitor Setup - Displays appear to configure twice

Hello all! I’m trying to track down the source of some odd behavior with my displays. When I log in (automatic, no visible greeter) my displays are correctly configured with two different wallpapers and polybar running at the top of my primary monitor. After approximately 3 seconds, the monitors will swap desktops along with polybar. Afterwards my secondary monitor acts as my primary and fullscreen applications will default to the secondary monitor.

I can work around this by creating a 10-monitor.conf file in /etc/X11/xorg.conf.d that specifies the proper layout and resolutions manually but I can still tell that this behavior kicks in a few seconds after the desktop is already loaded. While I was adjusting the position values (and rebooting to test) I noticed that the wallpapers would be restored, polybar would become activated, then a few seconds later the primary display would shift to the position specified in my monitor config file. This explains what was going on in the first paragraph: without a specific monitor configuration X was generating one which had my monitors swapped.

So, my question is where is this initial momentary configuration coming from? It’s perfect every time and loads instantly and I’d rather use it than whatever I set up to kick in 3 seconds later. I’ve checked my X logs and it looks like the displays are both configured twice with the first time using EDID and the second using values “from config file”. Any idea where to look from here? Thanks for the help.

Xorg.0.log (pastebin)

Hey @GrimFrenzy, I am a dual screen user. A couple of questions so I can help:

  1. What enviroment are you using?
  2. How are you setting your xrandr settings? VIa autostart or another method?
  3. What are your screen resolutions? Also the names of your connections
  4. Have you used aRandr to set resolution and screen position?

That should be enough to start with

Hi @Dobbie03, thanks for the help.

  1. I’m using openbox along with lightdm and compton
  2. I’m not sure how to determine this and I think it is the key issue. I’m using an Xorg configuration file to specify the resolutions and positions of my monitors but it seems like the xrandr settings are being set before that kicks in. Grepping journalctl, dmesg and Xorg.log for xrandr returns nothing… somewhere else I should be looking?
  3. Primary: HDMI-3, Acer S220HQL, 1920x1080; Secondary: HDMI-2, Dell 2407WFP, 1920x1200
  4. Yes. An interesting thing about aRandr is that there appears to be a large pale gray bounding box around both monitors that matches the height of the taller screen (1200px). I can move my primary monitor (1080px) up and down and save the configuration but when I move the monitor up, a black bar appears across the top of the screen and the desktop appears to shift down. Moving the monitor down in aRandr has the opposite effect, pushing the the desktop up. I would expect the desktop to remain centered in my monitor with only the cursor entry/exit alignment between desktops being changed. This might just be standard behavior though, I’m not sure.

It is possible to get the monitors reasonably lined up in aRandr but due to the snapping, I can’t quite get it perfect.

Edit: Added a screenshot. I initially took two screenshots, one with HDMI-3 moved up and the other with it moved down but in the screenshot there is no difference. When viewing from my monitor I’m either viewing the upper part of the screen or the lower part which just made me realize the HDMI-3 box in aRandr is more like moving a viewport.

Also checked in ~/.config/autostart, ~/.config/ob-autostart as well as /etc/lightdm.conf and found nothing related to monitor configuration or xrandr.

Sweet, firstly check in ~/.config/ that there are no settings saved by aRandr. If there are delete them.

In my Openbox autostart I have this line:

xrandr --output DisplayPort-0 --mode 3840x2160 --output HDMI-A-0 --auto --right-of DisplayPort-0

Just edit it to suit your set up it will be something like (depending on what position the screens are):

xrandr --output HDMI-3 --mode 1920x1080 --output HDMI-2 --1920x1200 --right-of HDMI-2

Hope this helps.

I couldn’t find any stray config files in my ~/.config/ folder that might be changing randr settings but the lines you shared did help me find the correct positioning of my displays. I had a few more issues centered around my secondary monitor being treated as the primary that I couldn’t fix with the --primary flag (polybar, some games, shutdown menu appearing on the wrong display). After struggling with it for awhile by configuring individual apps to appear on the main monitor I just swapped the cables between my monitors and everything worked perfectly!

So my desktops are loading and behaving properly now with no slightly delayed shifting into place. I’m still left with the question as to why they appeared to configure twice before; loading correctly then moving out of place seconds later but things are working well enough now for me to call this good and move on.

Thanks again for the help.

1 Like

Glad your issue is sorted. Would you mind selecting the post that sorted your issue as the solution. Use the tick in a box icon to do this.

solution

Definitely. Your xrandr lines would be helpful in most cases I think. I did ultimately use an Xorg conf file to configure my displays but that only worked after I swapped my monitor connections.

1 Like