csgo-osx-linux icon indicating copy to clipboard operation
csgo-osx-linux copied to clipboard

Linux: Game window goes away when another window / monitor is focused

Open jpleau opened this issue 12 years ago • 8 comments

On Linux , using a tiling window manager (such as i3) where there is no concept of "minimized windows", the following happen:

  1. Open the game
  2. Focus another window / workspace
  3. Game is now minimized, with no way of opening it besides killing the process and re-opening it again.

When the game is minimized, the process is still running, so it's not a crash.

Here's the output of xprop when the window is hidden:

_NET_WM_STATE(ATOM) = 
WM_STATE(WM_STATE):
        window state: Withdrawn
        icon window: 0x0
_NET_WM_NAME(UTF8_STRING) = "Counter-Strike: Global Offensive - OpenGL"
WM_NAME(STRING) = "Counter-Strike: Global Offensive - OpenGL"
XdndAware(ATOM) = BITMAP
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, _NET_WM_PING
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_PID(CARDINAL) = 23595
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLASS(STRING) = "csgo_linux", "csgo_linux"
WM_HINTS(WM_HINTS):
        Client accepts input or input focus: True
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        user specified location: 2560, 300
        program specified minimum size: 1920 by 1080
        program specified maximum size: 1920 by 1080
WM_CLIENT_MACHINE(STRING) = "goldeneye"
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x0, 0x1, 0x0, 0x0
STEAM_GAME(CARDINAL) = 730

The important part here is window state: Withdrawn

Most applications that minimize themselves will have a system tray icon to allow us to re-maximize the window. But since CS:GO doesn't have that, it's now an invisible that can't be brought back (at least in environments where minimized windows simply just don't exist)

More info on "IconicState":

http://www.x.org/archive/X11R7.5/doc/man/man3/XIconifyWindow.3.html

jpleau avatar Oct 09 '14 23:10 jpleau

Minimize is the default when the window looses focus. You have control over this and you can override this behavior with SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0 as noted at https://github.com/ValveSoftware/Source-1-Games/issues/462#issuecomment-17553604.

Tele42 avatar Oct 10 '14 04:10 Tele42

Posted it there but may also put this here. SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0 %command% In launch-options will prevent the game to minimize when focus is lost.

CommanderAlchemy avatar Oct 10 '14 14:10 CommanderAlchemy

This indeed solves my issue.

I didn't notice it before because in it's latest official release, i3 didn't handle those window states. In the development version it "hides" the window, assuming there'll be an icon in the notification area.

Thanks @Tele42 and @CommanderAlchemy

jpleau avatar Oct 10 '14 20:10 jpleau

Any ideas how could this issue be solved for ubuntu 14.04 with gtk2/3? I tried using the same launch option for CSGO in Steam settings, but it caused errors.

bsuttonq avatar Oct 15 '14 17:10 bsuttonq

@bsuttonq You've done something wrong, as this is a fairly safe env variable to set. What exactly did you put in the launch options and what is the error(s) you're seeing?

Tele42 avatar Oct 15 '14 17:10 Tele42

I tried both "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0" and "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0 %command%".

These were used in the Steam library properties for CSGO launch options.

My current launch options are as follows:

-noborder -novid -high -threads 3 -SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0

bsuttonq avatar Oct 15 '14 17:10 bsuttonq

It should read SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0 %command% -noborder -novid -high -threads 3 without quotes at the beginning and end. UPDATED in response to previous post's edit

Tele42 avatar Oct 15 '14 17:10 Tele42

Solved by changing launch options to the following, thanks for assistance:

SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0 %command% -noborder -novid -high -threads 3

bsuttonq avatar Oct 15 '14 17:10 bsuttonq