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?
4 Answers
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
.profileor.xprofile;.bashrcwould 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/profileor/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.profiledon'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=0If 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.shfile in the same directory as the game's main executable:#!/bin/sh export SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0 ./SomeGame "$@"
Add the following line:
export SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0to the file /etc/environment and reboot after that.
1Many games can be set to "borderless window", "windowed borderless" or something similar in the graphics settings. After you set it, the game will still be using the entire screen, but it will be considered a regular window by the OS. I think this can prevent the game being minimized when you click in the second screen.
1If you're struggling to find your local environment variables file, there's an easy way to add a new variable through control panel.
Follow these steps from
- In
Search, search for and then select:System (Control Panel) - Click the
Advancedsystem settings link. - Click
Environment Variables. - In the section
System Variablesfind thePATHenvironment variable and select it.
Once there select "new" and add the variable SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS with a value of 0 and save.
This should solve your issue without having to edit the file directly or use command line if you can't find the file.