Media keys unlock mouse from exclusive fullscreen application?

When playing certain games with long periods of downtime between moments of action (e.g. Receiver II), I like to have music or some YouTube videos playing on my second monitor during downtime, and then quickly pause it with the media keys on my keyboard when the game demands my focus.

However, I’ve found that with the game in exclusive fullscreen mode, once I press play/pause, my mouse unlocks from the game window and is able to wander off to the other monitor, where if I click, the game gets minimized.

This is the first real issue I’ve had since switching to Linux full time a little over six months ago, and I don’t really have any idea where to start with trying to fix it.

By clicking the browser (with the youtube video) or any other window, or the desktop, you have shifted focus to that window; effectively leaving fullscreen. This should be the expected outcome; albeit inconvenient at times.

A possible workaround might be to run your game windowed, instead.

1 Like

Sorry, allow me to clarify: Receiver is a first person game, and under normal operation it locks the mouse cursor to the center of it’s own game window. I agree that the game should lose focus if I click somewhere else by opening the pause menu and clicking the browser, but pressing the physical play/pause key on my keyboard doesn’t unfocus the game on it’s own, it just unlocks the cursor from the center of the window, making it possible to accidentally click another window after turning too far left in the game.

I’m hoping there’s some way to make it so that the mouse isn’t unlocked from the center of the game window when I use the physical play/pause key, in the same way that it doesn’t get unlocked when I use the physical volume control keys (as opposed to using the slider in the settings window or task bar pop-up)

When pressing play/pause on the keyboard, this action still arguably moves focus to a media control system, even though it might not seem obvious. I don’t know how you might overcome the stealing focus affect. I’ve experienced the same, or similar, for years; sometimes without having pressed a button, or clicked anything.

It seems to me that any issue will likely be with the game itself; in whatever mechanism governs how it should react in that situation. I’d be interested in knowing whether it still happens the way you describe when it’s played windowed.

1 Like

Try gamescope, it’s in official packages.

Because the game is running in its own personal Xwayland sandbox desktop, it can’t interfere with your desktop and your desktop can’t interfere with it.

Instructions here - GitHub - ValveSoftware/gamescope: SteamOS session compositing window manager

When playing in windowed mode, using the play/pause key still unlocks the mouse from the game, same as before. Of course, in windowed mode, accidentally clicking elsewhere because of the wandering mouse no longer minimizes the game, but it still does end up taking focus from the game, thus making my mouse no longer control the camera.

When pressing play/pause on the keyboard, this action still arguably moves focus to a media control system, even though it might not seem obvious.

I am reasonably certain that this isn’t what’s happening. Pressing the play/pause key doesn’t immediately cause the game to be minimized (in fullscreen mode), nor does it prevent mouse and keyboard input from controlling the game (in fullscreen or windowed mode). It just allows the mouse to wander freely to the other monitor. It’s only once I actually click with the mouse outside the game window that the game stops responding to input in windowed mode or is minimized in fullscreen mode.


Maybe someone else has deeper insight. I hope you find a workaround. Cheers.

1 Like

Thanks for trying, I appreciate it :slight_smile:

This StackExchange article suggests that adding SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0 to your bash or zsh profile may solve the issue. This might be worth investigating.

Some other possibly useful links: Gaming and Steam Game-specific troubleshooting from the ArchWiki. Cheers.