Don't want to see articles from a certain category? When logged in, go to your User Settings and adjust your feed in the Content Preferences section where you can block tags!
We do often include affiliate links to earn us some pennies. See more here.

I used to chuckle smugly whenever Liam wrote an article about yet another game that launches on the wrong monitor. That was never an issue for me on my single monitor set up, so continual woe for him was continual wry humour for me.

But in April this year, I did my first PC upgrade in over five years. It was a big upgrade, featuring both an epic graphics card and a shiny new Acer Predator monitor. But now I had a dilema... what do I do with the old 22" monitor I was using beforehand? You guessed it, I connected it up and placed it off to one side, the better to keep Chrome and Steam in view while gaming.

And of course, I immediately joined the "Wrong Monitor" crowd. If I'd known how frustrating this was, I'd have kept that smug grin off my face earlier. Clearly, karma likes to hit schadenfreude when it's down and Liam can consider this article my written and profuse apology.

It was pure torment. The order I connected them in was irrelevant. Display settings was irrelevant. Various xrandr endevours ended in frustration.  In fact, the only thing I found that would make a difference was a tick box in Nvida Settings called "Make this the primary display for the X screen":

But while that largely worked, it didn't stick between reboots, even when you hit "Save to X configuration File". It saved, but the tick always reverted to the wrong monitor regardless. Infuriating!

But that led, eventually, after far too much googling, to a potential solution. It's courtesy of this Ask Ubuntu answer, which I'll summarise here too. It's really straightforward. In fact, if you already know the device names of your monitors, you can skip straight to the final step!

1. First, install the arandr tool, which is a little GUI app to show monitor device names:

sudo apt-get install arandr

2. Then run it:

arandr

...and note the name of the monitor you wish to be primary. For me that was DP-5.

3. Finally, run xrandr to make that monitor the primary display:

xrandr --output DP-5 --primary

As noted in the original article, you can easily put that exact command into your Startup Applications directly to run this every time you log in to your PC.

For me, problem solved. If this works for you, be sure to upvote Etron's answer on Ask Ubuntu!

However, some have reported that this is only half the battle! There is one more step you might want to try. Having run all of the above, you might also need to:

  1. Browse to ~/.config/ and take a copy of your original monitors.xml file (just in case!)
  2. Delete the original - the next step will recreate it anyway.
  3. Open your system's control panel and choose displays (or in Ubuntu's case, run unity-control-centre display), then hit "apply" to create a new monitors.xml.

You can open this file in a text editor (such as gedit, geany or nano) and just make sure that only one of the entries has a "yes" against its "primary" field.

Also, GOL editor BTRE has a novel approach to this problem, using a custom xorg.conf. I've included his personal xorg.conf in a spoiler below. Note that his xorg.conf is for his mesa set up and doesn't actually include any options regarding primary monitor. For example, he has a TV set up in there which is disabled by default, but ready to be used if he activates it manually. So if you go down this road, make sure to add

Option      "Primary" "true"

...to one of your "Monitor" sections!

But if all else fails, or if you don't like the idea of running xrandr in a startup script on every login, maybe this will work for you.

Spoiler, click me - BTRE's xorg solution

Section "Monitor"
       Identifier   "DisplayPort-0"
       Option       "Primary" "true"
       Option       "DPMS" "false"
EndSection

Section "Monitor"
       Identifier   "DisplayPort-1"
       Option       "RightOf" "DisplayPort-0"
       Option       "DPMS" "false"
EndSection

Section "Monitor"
       Identifier   "TV"
#     Option      "Ignore" "true"
       Option      "Disable" "true"
       Option      "RightOf" "DVI-D-0"
       Option      "DPMS" "false"
EndSection

BTRE's note: The above is in /etc/X11/xorg.conf.d/10-monitor.conf The important bits are "Primary" and the positioning "RightOf", the rest is just stuff that may not apply to you (I prefer not to use DPMS and have a TV hooked up on HDMI I'd rather not get used until needed). This is just stuff you can find out more about in the Arch wiki.

If you have an alternative and/or bulletproof method, please (please!) share it in the comments. But so far, for me, the xrandr procedure I outline here has worked a treat.

Article taken from GamingOnLinux.com.
Tags: Hardware, HOWTO, Video
13 Likes
About the author -
author picture
I'm Neil, an avid Linux user since 2006 and a Linux-only gamer since 2013. I used to contribute to GOL's Funding Crowd articles, but now contribute the odd article directly, most recently the Play It Now series, and the IYL articles.

I also occasionally dabble a bit in Python, I do Internet Security for a living and finally, I'm a big fan of Neil Degrasse Tyson. And not just because he has a cool first name.
See more from me
The comments on this article are closed.
39 comments
Page: 1/2»
  Go to:

Maki Sep 19, 2017
This is very informative and should help others who have this dual-monitor issue.
It's a shame it has to be this convoluted, though...
Psycic101 Sep 19, 2017
Great article, scaine :D
marvtowel Sep 19, 2017
Thanks. I have had to use this as well when running a 120hz monitor and a 60hz.

xrandr --output DVI-[whateverTheDisplay] --mode 1920x1080 --refresh 120
BTRE Sep 19, 2017
View PC info
  • Contributing Editor
Edited and added a note by myself to the above because I didn't expect you'd paste my configuration! It'll probably avoid confusion if you know why I did that and where you can see more about the various options you can have ;)
const Sep 19, 2017
This also works with triple and quadruple monitors :)
tmtvl Sep 19, 2017
I find that KDE's display configuration works pretty well. But for awesome I had to set up my xorg.conf.d correctly.

Note that for outdated Xorg versions you don't have to specifically configure device and screen, but for an up to date Xorg they will need to be configured correctly.

I have my personal setup up on GitHub for reference.
oldgaro Sep 19, 2017
Or just use a decent Windows Manager like Dwm or i3wm...
scaine Sep 19, 2017
View PC info
  • Contributing Editor
  • Mega Supporter
Quoting: BTREEdited and added a note by myself to the above because I didn't expect you'd paste my configuration! It'll probably avoid confusion if you know why I did that and where you can see more about the various options you can have ;)

I did put in bold that this was a very custom config, but since it's another approach to the whole problem, I thought it was worth sharing. I'm no expert on xorg.conf though. I'd usually search the Arch Wiki for relevant stuff, to be honest! I might run Ubuntu, but that wiki is an absolute mine of useful information (e.g. https://wiki.archlinux.org/index.php/multihead#Configuration_using_xorg.conf)!

[EDIT: Ha! Just noticed that BTRE linked to much the same article! But the Arch Wiki was one of the avenues that led to the xrandr solution I settled on, via the whole "primary" clue. In summary, Arch Wiki is awesome.]


Last edited by scaine on 19 September 2017 at 9:36 pm UTC
razing32 Sep 19, 2017
Quoting: oldgaroOr just use a decent Windows Manager like Dwm or i3wm...

Wait ... so you don't have that issue there ? Never used i3 so curios.
kon14 10 years Sep 19, 2017
Quoting: oldgaroOr just use a decent Windows Manager like Dwm or i3wm...

Such retarded fanboy posts are what makes me wish we had an up/downvote system instead of an "abuse-safe" likes one.

Quoting: razing32Wait ... so you don't have that issue there ? Never used i3 so curios.

You don't have that cause in tilling wms every worksplace is dedicated to a single monitor (but you can have any number of workplaces regardless) so as long as a window is launched in or moved to your desired workplace there's no way it would show up in the wrong one.

edit: missed nested quote tags a trillion times, note to self: don't get triggered on mobile


Last edited by kon14 on 19 September 2017 at 10:22 pm UTC
Nezchan Sep 19, 2017
I've had this problem a number of times. Pity you have to jump through so many hoops for a solution, but I might do it anyway.
Philadelphus Sep 19, 2017
Serious question: is right-clicking the game icon in the task bar and selecting "Move to the other monitor" not a feature on most desktops? I mean, it takes all of 5 seconds in Cinnamon. I agree it should be easier to set a primary monitor and have it stick, but it's just such a non-issue to me. (Though I'll concede that it's possible it's less of an issue for me because I have two identical monitors, so I don't really care where a game pops up. I could see it being a problem if you have a bigger/better monitor you want to play games on and smaller/worse secondary one for other things.)
tmtvl Sep 20, 2017
Quoting: PhiladelphusSerious question: is right-clicking the game icon in the task bar and selecting "Move to the other monitor" not a feature on most desktops?

Well, you're assuming the application doesn't capture the mouse and doesn't behave weirdly when moved between monitors.

That said, I have "switch between monitors" bound to ctrl-alt-left/right, which also helps me run applications when one of my monitors is showing a different machine.
sn0rlax Sep 20, 2017
The "Save to X file" option in Nvidia Settings works, but you need to be sure to then move that file you just created to /etc/X11/xorg.conf.d/ This is where X looks for configurations upon boot.
Shmerl Sep 20, 2017
I suspect KDE offers a better experience for it by now.
MayeulC Sep 20, 2017
Worked pretty well on KDE last time I tried. Except for Payday 2.

I usually drag windows to the correct monitor with alt+click if they show up on the wrong one. Some windows require the Steam overlay to be open for this to work.

Also, I think you have less trouble if your primary monitor is on on the left (which has almost never been the case for me, sadly).
Shmerl Sep 20, 2017
Quoting: MayeulCWorked pretty well on KDE last time I tried. Except for Payday 2.

I usually drag windows to the correct monitor with alt+click if they show up on the wrong one. Some windows require the Steam overlay to be open for this to work.

Also, I think you have less trouble if your primary monitor is on on the left (which has almost never been the case for me, sadly).

If things get messed up consistently for some application, KWin offers quite flexible windows rules for that, which can assign specific window to specific screen.


Last edited by Shmerl on 20 September 2017 at 5:27 am UTC
scaine Sep 20, 2017
View PC info
  • Contributing Editor
  • Mega Supporter
Quoting: sn0rlaxThe "Save to X file" option in Nvidia Settings works, but you need to be sure to then move that file you just created to /etc/X11/xorg.conf.d/ This is where X looks for configurations upon boot.

Yep, the "Save to X file" option works for me too, and unlike you, I don't have to move the file - it really does "just work". However, that particular option doesn't work - it would always revert to HDMI-0 on reboot. Pretty frustrating, as all the other options would save perfectly.

For everyone saying something along the lines of "just move the window", well...

a) What a hassle, right? This is about avoiding the need to do so, and
b) If you have different resolutions per monitor, that doesn't work too well. When I was running the Acer in 4K mode, the window would pop on my old monitor at 1920x1080. Even if I moved it, I'd have to then set the game options to the correct resolution. It was pretty tedious.

Also, some games just crap out horribly when they're moved. Unity games in particular seem to offset the mouse slightly... which I suspect is a Unity thing, because the offset looks suspiciously like the distance related to the size of the dash. Just a guess though.

QuoteOr just use a decent Windows Manager like Dwm or i3wm...

Well damn, but dwm looks ugly. And i3wm is a tiler, right, which isn't really my preference. But either way, this is about setting a default monitor, and less about the desktop environment remembering where you like a window or full screen app to appear. Unless you meant that these DEs have an inbuilt way to specify a default monitor, in which case, cool, but still not really my preference to be honest.
Shmerl Sep 20, 2017
Quoting: scaineUnless you meant that these DEs have an inbuilt way to specify a default monitor, in which case, cool, but still not really my preference to be honest.

KDE has the primary screen setting.
scaine Sep 20, 2017
View PC info
  • Contributing Editor
  • Mega Supporter
Quoting: Shmerl
Quoting: scaineUnless you meant that these DEs have an inbuilt way to specify a default monitor, in which case, cool, but still not really my preference to be honest.

KDE has the primary screen setting.

Gotcha. Honestly, I'd have given KDE a shot if I'd known that. But I'm glad this fixes it for me, since I do prefer gnome to KDE. Although, my last KDE trip was back in the early KDE4 days so that's probably not a fair comparison.

Quoting: MayeulCWorked pretty well on KDE last time I tried. Except for Payday 2.

I usually drag windows to the correct monitor with alt+click if they show up on the wrong one. Some windows require the Steam overlay to be open for this to work.

Also, I think you have less trouble if your primary monitor is on on the left (which has almost never been the case for me, sadly).

My primary monitor, the Acer, is on the left, but it would also default to the right monitor! :D

Also, Liam has tried this article's solution and found that some games, for him, still ignore the setting, like DOTA 2. I couldn't replicate his result though - this article has fully fixed the whole "wrong monitor" issue for me. At least so far. I've started about 10 or so games since making this change, including maybe about 4 brand new, freshly installed games, and they've all started on the correct monitor now.
While you're here, please consider supporting GamingOnLinux on:

Reward Tiers: Patreon. Plain Donations: PayPal.

This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
The comments on this article are closed.