Way to force cursor grab for a game window

Hello, I am running Bazzite on a desktop with two monitors and I have a question. Is it possible to force cursor grabbing to a window for a game? I recently ran into some issues with Fallout 4. The game is set to Exclusive Fullscreen, and it's cursor respects its own window, but the OS cursor pops right out and continues going to the other screen. Similarly, I have ran into other games such as Age of Wonders 4 which really just offer windowed borderless. For strategy game is not as much of an issue, but I will like to get have a way to lock to cursor that is not dependent on the developer to add a bespoke setting.
Solution:
Alright, did some testing and it works. For anyone finding this thread for Lutris: -Go to the game and right click, the configure. -Go to System Options. Scroll down to Gamescope. -Toggle Gamescope on. Toggle "Relative Mouse Mode" on. Set resolutions to your monitor resolutions for both Output and Game. Then, make sure Window Mode is Fullscreen....
Jump to solution
13 Replies
HikariKnight
HikariKnightβ€’4mo ago
set the games launch options to gamescope -w inputwidth -h inputheight -W outputwidth -H outputheight -e -- %command% this will open it inside a gamescope window and the game will think that gamescope is the only monitor that exists fixes issues like this usually
Aldran
AldranOPβ€’4mo ago
Sorry, forgot to mention that this is running through Lutris from GOG
HikariKnight
HikariKnightβ€’4mo ago
if you have a polaris card use gamescope-legacy instead
Aldran
AldranOPβ€’4mo ago
but the command is usefull for Steam games regardless
HikariKnight
HikariKnightβ€’4mo ago
lutris has a gamescope toggle wont work on polaris cards though since it uses the gamescope binary and does not know about gamescope-legacy
Aldran
AldranOPβ€’4mo ago
This would be ran in System options > Command Prefix, correct?
HikariKnight
HikariKnightβ€’4mo ago
i dont use lutris myself but should be somewhere for the game/prefix settings i think
Aldran
AldranOPβ€’4mo ago
I am going to double check it in Steam, but sadly it did not work. The game window maintains focus now if one clicks off the screen, but it does prevent the cursor just leaving it.
HikariKnight
HikariKnightβ€’4mo ago
it is not perfect but it solves the main problem there is a --force-grab-cursor flag too, never had to use it --force-grab-cursor always use relative mouse mode instead of flipping dependent on cursor visibility.
Aldran
AldranOPβ€’4mo ago
I will test further tomorrow. It seems promising. It complains about Gamescope WSI Layer Error errors left and right but --force-grab-cursor is doing it!
HikariKnight
HikariKnightβ€’4mo ago
try set ENABLE_GAMESCOPE_WSI=0 as env var for the game, might help
Solution
Aldran
Aldranβ€’4mo ago
Alright, did some testing and it works. For anyone finding this thread for Lutris: -Go to the game and right click, the configure. -Go to System Options. Scroll down to Gamescope. -Toggle Gamescope on. Toggle "Relative Mouse Mode" on. Set resolutions to your monitor resolutions for both Output and Game. Then, make sure Window Mode is Fullscreen. This cause Fallout to lock the mouse inside the screen. It does seem that it does not shut down 100% properly but stopping the game in Lutris works. As for Fallout London. Sadly, this breaks F4SE. Disabling the above settings works, but you go back to the initial mouse issue with Fallout 4. I do think this issue is caused by weirdness with Gamescope so this it out of scope of the original issue. Thanks @HikariKnight for all the help.
HikariKnight
HikariKnightβ€’4mo ago
mark it as the solution and we are all good then πŸ™‚ right click your message and choose "apps" and mark as solution πŸ™‚
Want results from more Discord servers?
Add your server