Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux] CS:GO sometimes launches on the wrong monitor #60

Open
Locat opened this issue Sep 23, 2014 · 41 comments
Open

[Linux] CS:GO sometimes launches on the wrong monitor #60

Locat opened this issue Sep 23, 2014 · 41 comments
Labels

Comments

@Locat
Copy link

Locat commented Sep 23, 2014

I have 2 monitors. My main monitor is correctly configured and when launching Dota 2, I have no problem with this whatsoever. So it seems like a CS:GO related problem. When rebooting the problem goes away but after playing for a bit quitting the game and launching it back it reappears.

https://gist.github.com/Locat/17842717e965193629f6

@Thermionix
Copy link

would really like tips on fixing this too

@speedfreak01
Copy link

I had the same issue as well. To get the game on the correct screen i just disabled the other monitor temporarily whilst i played.

Im not sure if this is specifically related to CS:GO though, given i have had the same issues with some other steam games.
Would be cool if the steam client allowed you to specify which screen you want a game to run on.

@Locat
Copy link
Author

Locat commented Sep 24, 2014

Yeah might be dependant on games. Dota 2 works fine though. It's a really frustrating bug, the worst is that sometimes it works and sometimes not and I have not a single clue as to why.

Edit: The only way I found of fixing it atm is going into either fullscreen windowed or windowed mode, dragging the window the right monitor and then going back to fullscreen.

@CommanderAlchemy
Copy link

Not sure if this is the cause but see what monitor is primary in both Xorg and in VM.

@Locat
Copy link
Author

Locat commented Sep 25, 2014

It is already the case.

@qshane
Copy link

qshane commented Sep 25, 2014

CS:GO opens up on my primary monitor as expected.

Also, are you all using the same resolution on both monitors?

@Locat
Copy link
Author

Locat commented Sep 26, 2014

One is a 5:4 monitor and one a 16:9 so not the same resolution. As I said it is strange because it works at first and then it stops working, even when the focus is on the right monitor

@audkar
Copy link

audkar commented Sep 26, 2014

I have similar problem: My 2nd monitor is set as primary in linux system but CS start fullscreen on 1st one.

2 monitors setup

  • monitor1 (left side), monitor2 (right side) [primary]. With this configuration CS start on first one.
  • If it change their order to monitor2 (left side), monitor1(right side (1024)), then CS start on my monitor2...

@Slydder
Copy link

Slydder commented Sep 28, 2014

same problem here.

@devhen
Copy link

devhen commented Jan 14, 2015

Same. It usually opens on my primary display but sometimes opens on the secondary. I was hoping there might be a way to force which monitor it uses.

@devhen
Copy link

devhen commented Jan 22, 2015

FYI, I've been able to get around it by disabling my secondary monitor in GNOME3, start the game, then alt-tab out and re-enable the secondary monitor.

@gulafaran
Copy link

same problem here too. however i just set the second monitor as "primary" and it opens on the right one but that means i need to change it back when im opening any other game.

@jocelynthode
Copy link

@devhen @gulafaran : You can simply hit the "Super" key and drag the csgo window on the right monitor :)

@gulafaran
Copy link

so funny, no matter what sdl env var i change nor xorg conf, the game will ALWAYS open on the non primary one.

@mariodonofrio
Copy link

Can you let me know what "sdl_displayindex" is set to in your config.cfg (in the game/csgo/cfg folder). This is not a public convar, but the value is written to/read from this file, and if changing it (if you have two monitors, the range of values is just 0 and 1) makes any difference to how the game boots up - the multi-monitor startup configuration should be handled the same way as Dota2.
Thanks.

@audkar
Copy link

audkar commented Feb 2, 2015

@mariodonofrio changing "sdl_displayindex" variable value fix'ed this issue for me

@mariodonofrio
Copy link

Thanks @audkar - sdl_displayindex should get written with whichever monitor you last played CS:GO on (i.e. if you move it to another monitor it will change). There are some issues with SDL not enumerating the displays correctly on all boxes, but if you moved it to a display it should put it back up on that same display regardless of enumeration. It might be worth trying to do that, and enforcing the change by modifying the video settings (change resolution, go full-screen or windowed, etc) and saving them - this should force the sdl_displayindex update in that config file.

Be interested in hearing what other users that have had issues might experience too.

@gulafaran
Copy link

yeah changing displayindex to 1 , makes it open on my middle monitor. i run three and the mid one is set as primary and most things works with this even something as basic as https://wiki.libsdl.org/SDL_GetCurrentDisplayMode orders it correctly, however steam and its games seems to open the games on the most left one at all times.

@bsuttonq
Copy link

Confirmed that changing the config.cfg sdl_displayindex solved this issue for me.

@bm956
Copy link

bm956 commented Dec 16, 2015

Any push to get this fixed? Is it backlogged?

@Dotile
Copy link

Dotile commented Apr 23, 2016

I have no config.cfg file in my folder only to other files named config containing the keyboard and 360 controller configuration.

Can I create my own config.cfg file and add sdl_displayindex?

@Tele42
Copy link
Contributor

Tele42 commented Jun 24, 2016

@Dotile, your config.cfg should be located at ~/.local/share/Steam/userdata/<steamid>/730/local/cfg/config.cfg or similar, depending on where your distro put the steam folder.

Note for dev: I suspect all affected users have a primary monitor to the right, sdl_displayindex 0 is the primary monitor, and CS:GO is not enumerating the monitors in the correct order. The physical connections going to the displays are most likely not enumerated from the leftmost to the rightmost.

@Mercotui
Copy link

still an issue, combined with #608 #4566 and #528 for me

@AntouanK
Copy link

AntouanK commented Feb 4, 2017

Dota 2 does launch in the secondary monitor for me.
I do use xrandr to set the primary monitor, and tried nvidia-setting as well. Still it keeps launching in the secondary one.
Big picture mode does the same.

Any idea how to fix it?

@birgersp
Copy link

birgersp commented Mar 8, 2017

+1

Would love to see this fixed!

@kaskii
Copy link

kaskii commented May 10, 2017

Had same problem on Linux Mint (18.1, dual monitor, nvidia-375) with CS:GO after alt+tabbing out of the game. I fixed it by changing to windowed mode, dragging window to correct display and changing full screen mode back. Haven't tested changing sdl_displayindex as now the game opens on correct display every time.

@kisak-valve
Copy link
Member

kisak-valve commented May 23, 2017

For everyone currently affected, please switch the game to windowed, dragging it to the preferred monitor, then switching it back to the previous display mode (fullscreen or fullscreen windowed) and close CS:GO to make sure the setting is saved.

If this does not resolve the issue, please describe your monitor layout with emphasis on the primary monitor and the order the monitors are enumerated. Also include your distro version.

@Mercotui
Copy link

Mercotui commented May 23, 2017

screenshot from 2017-05-23 17-33-00
I tried the method described by @kisak-valve , but with minimal succes.

Expected behavior:

Game starts on the primary monitor, with the correct primary monitors resolution.

Actual behavior:

The game now starts on my primary monitor, but in the secondary resolution, leaving undrawn areas of the window. See picture, The chrome browser running on the secondary monitor, and the game running on the primary monitor, with incorrect resolution.
Note that if I forcibly move the game away and back to the primary monitor, the resolution adapts correctly.

Setup:

CSGO buildID: 1831910
Distro: Fedora 24
Monitor enumerated as 1: VGA display, labeled secondary monitor in gnomeshell resolution 1280x1024
Monitor enumerated as 2: HDMI display, labeled primary monitor in gnomeshell; resolution 1920x1080
Monitor 1 (secondary monitor), is positioned left of Monitor 2 (primary monitor).

@kisak-valve
Copy link
Member

The resolution mismatch is being tracked at #1322.

@Mercotui
Copy link

actually, testing it more (testing is very slow because of #608 ) it seems the following happens:

I set the correct monitor by the method described by @kisak-valve .
First time starting the game afterwards: it launches on the primary monitor, but in the secondary's resolution.
Any additional attempt afterwards: the games launches in the secondary monitor, in the secondary's resolution.

@kisak-valve
Copy link
Member

Sdl_displayindex is getting reset to 0 if the game is minimized / alt-tabbed at any point. While the window is restored to the correct monitor, this change is commited to the config when the game is closed and then launches on the wrong monitor on the next start of the game.

@maksymovi
Copy link

maksymovi commented May 26, 2018

I am continuing to have the issue, the sdl_displayindex workaround of course works but generally gets reset every time the game is launched with no success so far to change this through normal means. I have found that using "sudo chatter +i config.cfg" will not allow one to reset it (for those unaware, this applies the immutable tag to the file, making it impossible to change for even the superuser, unless the tag is first removed with chattr -i config.cfg). I believe this will also not allow you to change any csgo settings however so it is not ideal.

Currently my biggest problem however remains to be #1322

@FailedCode
Copy link

Happens to me too after the update from Ubuntu 16.04 to 18.04

@FailedCode
Copy link

FailedCode commented Oct 21, 2018

Well. I had some trouble with Devil Daggers not starting and tried a steam --reset
All games where marked as uninstalled and for some reason the steam executable is now located in /usr/games/steam (I think it was /usr/bin/steam before).
BUT after reinstalling csgo will now start on my main monitor as it used to. Weird.
Oh, Devil Daggers also starts up fine again, but for that I had installed libcurl3 which might or might not have helped.
If you try the reset option, remember to save your config first.
Edit: now the problem is #1322 ...

@BloodyIron
Copy link

For some reason my config.cfg had "sdl_displayindex 1" set. I have 3x1920x1080 monitors, and this resulted in the game launching on my left monitor, yet my middle one is set as Primary/Default in my environment.

Setting it to "0" in the in-game console (then gracefully quitting) "resolved" this, however I think having in-game settings support for this facet really is the best long-term way to do this. Since this issue really isn't self-evident of the cause.

@szmarczak
Copy link

Welp, it's still here! 6yrs and counting 🤦‍♂️

@jeppenodgaard
Copy link

actually, testing it more (testing is very slow because of #608 ) it seems the following happens:

I set the correct monitor by the method described by @kisak-valve .
First time starting the game afterwards: it launches on the primary monitor, but in the secondary's resolution.
Any additional attempt afterwards: the games launches in the secondary monitor, in the secondary's resolution.

The same happens on Pop!_OS 20.04

@kisak-valve
Copy link
Member

Ubuntu two monitor setup and fullscreen modus: Game always starts on secondary monitor

Issue transferred from #2542.
@ptck posted on 2020-10-23T12:28:24:

Your system information

Please describe your issue in as much detail as possible:

I have two monitors. One with 1920x1080 resolution (primary) and an old 4:3 monitor (secondary) on the left side on my desk.
I had this problem under Ubuntu 16.04 and also now on 20.04 (I set my computer completely new up for this). When I start the game it always starts on my 4:3 monitor. Dragging it over to the primary screen doesn't help as when I hover over a button with my mouse the game register it as a hover somewhere else. Probably because the game is still in the 4:3 modus. Adding "-fullscreen" to launch options doesn't help. The only solution is to disconnect my 4:3 monitor from my PC so that I have only one monitor.

Also as a side note: If I start the game I get for a couple for seconds a black screen and a "csgo_linux64 not responding" warning before the CS:GO starting screen appears. All in all the game needs 15-20 seconds to start up.

Steps for reproducing this issue:

  1. Having 2 screens with different resolutions
  2. Have Ubuntu
  3. Have the secondary screen on the left, the primary screen on the right

@kisak-valve commented on 2020-10-23T12:47:44:

Hello @ptck, this issue is already being tracked at #60 with a possible workaround at #60 (comment).

Also, your side note is being tracked at #665.

Closing as a duplicate.


@ptck commented on 2020-10-23T14:25:47:

@kisak-valve Thanks for #60. Unfortunately none of the suggestions there helped.


@kisak-valve commented on 2020-10-23T14:30:29:

Just to check, did you remove the -fullscreen launch option while testing?

@philippkant
Copy link

philippkant commented Oct 23, 2020

@kisak-valve

screenshot from 2017-05-23 17-33-00
I tried the method described by @kisak-valve , but with minimal succes.

Expected behavior:

Game starts on the primary monitor, with the correct primary monitors resolution.

Actual behavior:

The game now starts on my primary monitor, but in the secondary resolution, leaving undrawn areas of the window. See picture, The chrome browser running on the secondary monitor, and the game running on the primary monitor, with incorrect resolution.
Note that if I forcibly move the game away and back to the primary monitor, the resolution adapts correctly.

Setup:

CSGO buildID: 1831910
Distro: Fedora 24
Monitor enumerated as 1: VGA display, labeled secondary monitor in gnomeshell resolution 1280x1024
Monitor enumerated as 2: HDMI display, labeled primary monitor in gnomeshell; resolution 1920x1080
Monitor 1 (secondary monitor), is positioned left of Monitor 2 (primary monitor).

I have the exact same issue. My monitors are enumerated exactly like this in the Ubuntu display settings (1 and 2) and I have the same resolutions for both monitors. My secondary monitor is also positioned left of my primary monitor. The only difference is that I have Ubuntu 20.04 and my primary monitor is connected via DVI, not HDMI. To expand on this: sdl_displayindex is always resetted to 1. I did not set any launch options.

actually, testing it more (testing is very slow because of #608 ) it seems the following happens:

I set the correct monitor by the method described by @kisak-valve .
First time starting the game afterwards: it launches on the primary monitor, but in the secondary's resolution.
Any additional attempt afterwards: the games launches in the secondary monitor, in the secondary's resolution.

Also this is the same for me. But I don't have a long startup time (15-20 seconds).

@ericek111
Copy link

ericek111 commented Dec 19, 2020

Another workaround for X11:

wpid=$(xprop -id `xdotool getwindowfocus` | grep '_NET_WM_PID' | grep -oE '[[:digit:]]*$')
win=$(xdotool search --pid $wpid | head -n1)
wmctrl -i -r $win -e 0,1920,0,-1,-1

Put this into a script, bind it to a keyboard shortcut or add it to ~/.steam/steam/steamapps/common/Counter-Strike Global Offensive/csgo.sh with some sleep before it. Works for any game (I had problems with GTA V launching on the wrong monitor.

EDIT: Oh, works only until the game is minimized, then it jumps back to the left-most monitor.

@pschichtel
Copy link

I had success using gamescope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests