Games sometimes open with the wrong monitor's settings

Once in a while games open on the right monitor but with the settings of the other monitor.

No idea why this happens, maybe related to xwayland or resuming from sleep. I run most games through steam/proton if that matters at all.

It is because Wayland doesn’t have a primary monitor. Installing xrandr and adding exec-once = xrandr --output <monitor name IN X11> --primary and it should fix it

It’s set as primary already:

$ xrandr   
Screen 0: minimum 16 x 16, current 5360 x 1440, maximum 32767 x 32767
DP-2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 540mm x 300mm
   1920x1080    143.88*+
   1440x1080    143.80  
   1400x1050    143.89  
   1280x1024    143.79  
   1280x960     143.86  
   1152x864     143.92  
   1024x768     143.87  
   800x600      143.83  
   640x480      143.85  
   320x240      142.05  
   1680x1050    143.88  
   1440x900     143.86  
   1280x800     143.84  
   1152x720     143.77  
   960x600      143.72  
   928x580      143.50  
   800x500      143.68  
   768x480      143.69  
   720x480      143.85  
   640x400      143.37  
   320x200      141.40  
   1600x900     143.93  
   1368x768     143.77  
   1280x720     143.67  
   1024x576     143.91  
   864x486      143.63  
   720x400      143.88  
   640x350      143.57  
DP-3 connected primary 3440x1440+1920+0 (normal left inverted right x axis y axis) 800mm x 330mm
   3440x1440    143.88*+
   1920x1440    143.84  
   1600x1200    143.89  
   1440x1080    143.80  
   1400x1050    143.89  
   1280x1024    143.79  
   1280x960     143.86  
   1152x864     143.75  
   1024x768     143.66  
   800x600      143.83  
   640x480      143.30  
   320x240      142.05  
   1920x1200    143.89  
   1680x1050    143.88  
   1440x900     143.86  
   1280x800     143.67  
   1152x720     143.77  
   960x600      143.72  
   928x580      143.50  
   800x500      143.68  
   768x480      143.69  
   720x480      143.35  
   640x400      143.37  
   320x200      141.40  
   2560x1440    143.87  
   2048x1152    143.88  
   1920x1080    143.80  
   1600x900     143.81  
   1368x768     143.77  
   1280x720     143.67  
   1024x576     143.91  
   864x486      143.63  
   720x400      143.29  
   640x350      143.57  

Are you running xrandr in Hyprland? You need to know the name of your monitor in an X11 environment. I don’t know a better solution, but I installed something like i3, ran xrandr there and got the name. In my case, DP-1 became DisplayPort-0. Then you add that to the exec-once

Yes, xrandr is being run when hyprland loads.

So this happened again today and after running xrandr the primary had disappeared:

image

image

The second one is from rerunning xrandr --output DP-3 --primary afterwards.

This seems to happen (sometimes, rarely) when resuming from suspend. Also, all the workspaces got yeeted to the other screen. I’m guessing hyprland is resuming before the second monitor has a chance to come back from suspend.