Windows – How to stop fullscreen games from minimizing when I click on another window on the second monitor

fullscreenmultiple-monitorswindows 10

I am trying to play a game that doesn't have a borderless window mode, and I don't want to use the normal windowed mode on the game.

I use two monitors, one as a large main monitor, and one as something to keep track of chats, wikis, and the like. Most games I play have an option to keep the full-screen game on top (borderless window mode) while I play, but, for the games that don't have this feature, it can be pretty frustrating.

Is there any way to force the game to stay maximized if I click on my second monitor?

Best Answer

I don't have enough rep to comment on gunix's answer, but someone asked for context, so I'll just write my own answer.

This behavior is generally caused by SDL, a commonly used library for creating OpenGL contexts for games to render things into. This commit to libSDL2 in 2012 adds an environment variable, SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS, which, as the name suggests, controls whether or not the game will minimize itself if it loses window focus.

To stop this behavior, you need to set this environment variable to 0. There are a few ways to do this:

  • Modify your local environment files, located somewhere in your home directory, perhaps .profile or .xprofile; .bashrc would set it for your Bash shell but that might not be helpful if you're logged in via xdm or one of its many alternatives. This would affect all games using SDL and run as your user.
  • Modify your global environment files, usually /etc/profile or /etc/environment. Compared to the environment files in your home directory, this is not a recommended choice, but if you're the only user on the system and changes to .profile don't seem to apply even after logging out and back in again, this is a second thing to try.

For both of the above options, you would add this line:

    export SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0
  • If this is a Steam game, you can add it to your launch options:

      SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0 %command%
    
  • If this isn't a Steam game, but you still want to change it for this one game only, you could create a launch_game.sh file in the same directory as the game's main executable:

      #!/bin/sh
      export SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0
      ./SomeGame "$@"
    
Related Question