Every article tag can be clicked to get a list of all articles in that category. Every article tag also has an RSS feed! You can customize an RSS feed too!
Valheim fails to capture cursor when building.
Page: 1/2»
  Go to:
Dalgam Jun 14, 2023
My System Info

Linux Distribution: Fedora 38
Desktop Environment: Gnome 44.2
Graphics Card: GTX 1080
GPU Driver Version: Proprietary 530.41.03

Have you checked for system updates?: Yes

If this is to do with Steam, please add your system read-out from Steam -> Help -> System Information (please put that into Pastebin/Gist as linked above!):
https://pastebin.com/ETLiunDn

You can note your issue below here
Hi all! I'm encountering an issue where my cursor leaves the game window when building, and though I would try my luck at finding a solution here. I've tried using gamescope which does solve the problem, but I can only launch the game about 5% of the time, the other 95% just freeze the entire window and I have to kill processes. Worth noting is that I'm using X11.

Note any particular steps to reproduce it below here
Install the game and play it on a multi-monitor setup.
Liam Dawe Jun 14, 2023
I've found this issue at random with lots of games on dual-monitor situations. Ideally, the developer needs to ensure themselves that they have a mouse lock. I haven't yet found a way myself to fix it otherwise. Maybe someone else knows.
Grogan Jun 15, 2023
Do you mean, your mouse cursor disappears and then you have no input on the game window after that?

Possibly losing focus. A simple thing to try is to press ALT+TAB a few times, it might get it back. Another workaround, is to CLICK the mouse on every screen as a game is loading.
Dalgam Jun 15, 2023
Quoting: Liam DaweI've found this issue at random with lots of games on dual-monitor situations. Ideally, the developer needs to ensure themselves that they have a mouse lock. I haven't yet found a way myself to fix it otherwise. Maybe someone else knows.

Thanks for the input! I suspected as much, I might have to try and file a bug report if the devs have a place for that.

Quoting: GroganDo you mean, your mouse cursor disappears, and then you have no input on the game window after that?

Possibly losing focus. A simple thing to try is to press ALT+TAB a few times, it might get it back. Another workaround, is to CLICK the mouse on every screen as a game is loading.

The issue is that the mouse doesn't lock to the game window after using the tool in game that allows for building. I suspect that the issue is that a menu appears to select an object to build, which presents an in-game cursor. When that menu closes, and you get back control of the character, the mouse input doesn't get locked to the game properly and can travel into the 2nd monitor.

The issue can be worked around by clicking the window a couple of times, I'll have to try alt-tabbing as well, but the problem with clicking is that all mouse inputs is an action causing me to build, destroy, or re-open the build menu again. One can of course look straight into the sky so that the actions doesn't do anything, but that tends to activate the GNOME hot corner a lot, making the whole ordeal a bit tedious.
Grogan Jun 15, 2023
I've had a lot of trouble with focus loss in games. It can manifest in strange ways too (like initial display corruption that made me think a game didn't work with the Proton I was using etc.). For example, on starting, I have an older game that I love, F.E.A.R. 2 Project Origin that does that. It's all split screen corruption with the active area in a little tiny portion of the screen until I get the main menu screen back in focus. (however, IF I try that while the intro logos are playing, the game will beshit itself, I have to wait for the menu screen). The first step is recognizing if a problem is being caused by focus loss.

This isn't all relevant to you, but this is the crap I put up with and what I do about it.

I used to have problems with mouse breaking out of game and activating auto-hide panels and desktop things like that too. I went through a few desktops/WMs. Trinity/TDE (love that, but started having mouse breakout problems), Lumina desktop with Fluxbox (love that too, but still had minor issues). KDE Plasma is just too much bloat and mess for me.

Eventually, my final solution was IceWM because of its ability to strictly enforce focus behaviour with fine grained settings. It also has a window list that I can bring up with ctrl-alt-esc that just cuts through the slime and brings a game into focus when highlighted with arrow keys and Enter. That's my last resort, and it never lets me down (except in the event of a finicky game that can't tolerate a focus change at all, and freezes/crashes/corrupts... one such example for me is Rage 2, but Borderless Windowed mode completely eliminates any problems for me with that one)

I haven't seen Gnome in a very long time, but does it have a window list you can bring up with a hotkey? I can't say how well that would work out, it could itself not get focus and alt-tab may not get you there either (seen that behaviour in other desktop environments with games too).

Last edited by Grogan on 15 June 2023 at 6:54 pm UTC
Dalgam Jun 15, 2023
Reported the bug in their Discord channel, so here's to hoping something will happen. I did also notice that just bringing the mouse back onto the window seems to lock it again, so moving the cursor out and then back in might be a less annoying workaround for right now.
Grogan Jun 15, 2023
I'd agree, reporting that as a bug is fair game. That really ought not to happen at all with a Linux native game.
Dalgam Jun 15, 2023
Quoting: GroganI've had a lot of trouble with focus loss in games. It can manifest in strange ways too (like initial display corruption that made me think a game didn't work with the Proton I was using etc.).
/.../

I can fully relate to a lot in that text. I switched to primarily use Linux on desktop about a year ago, and trying different DEs and trying to navigate all the issues can be a real adventure! I'm a bit too much of a newbie to feel comfortable poking around with some of the more niche DEs and WMs but maybe some day, I'm pretty happy with GNOME right now to be fair.

There is a task switcher in GNOME, so alt-tabbing is definitely something worth trying in this scenario. The devs seem to be aware of the issue and the game is still in development, so there's at least some hope to get it resolved in the proper way. Hopefully it will be a priority to be patched
rcrit Jun 20, 2023
I'm seeing the same in Valheim (though no other games I play). Someone filed this 3 months ago but it is still in moderation, https://valheimbugs.featureupvote.com/suggestions/436152/cursor-not-properly-captured-on-linux-multimonitor-after-0214300-patch

I'll try the alt-tab thing. I worked around it by clicking like mad, changing viewing angle and a whole lot of swearing.
Dalgam Jun 20, 2023
Quoting: rcritI'm seeing the same in Valheim (though no other games I play). Someone filed this 3 months ago but it is still in moderation, https://valheimbugs.featureupvote.com/suggestions/436152/cursor-not-properly-captured-on-linux-multimonitor-after-0214300-patch

I'll try the alt-tab thing. I worked around it by clicking like mad, changing viewing angle and a whole lot of swearing.

That was my strategy as well. I did however notice that if I purposefully moved the cursor onto my 2nd monitor and then back onto the game, it would magically start locking it again. Worth trying if it can be reproduced on your side as well :)

Last edited by Dalgam on 20 June 2023 at 7:06 pm UTC
Vortex_Acherontic Jun 23, 2023
Noticed this issue as well but was thinking it was related to my Setup as I run Gnome 44 on Wayland + NVidia.

The only fix I found was to run Valheim via Proton, but that cripples the performance as it is common for some Unity based games due to some weird threading the engine tires to use. At least this is the explanation I came up:
In earlier Proton version (before 6.0 I believe) it was enough to limit the cores visible to the Uniy game using taskset -c 0,2,4,6 %command% and it fixed the performance.
Doesn't work that well meanwhile. Not even if you disable FSync ... :(

Another solution might be running Valheim with Gamescope, so game scrop does the mouse capture unless you Alt+Tab or press Meta on Gnome to release the cursor.
Unfortunate Gamescope doesn’t work for me atm .. it once did but then someday stopped doing so :/

What I do to get the mouse pointer back into the game is to open the Steam Overlay, move my pointer atop Valheim and close the Overlay.
While you're here, please consider supporting GamingOnLinux on:

Reward Tiers: Patreon. Plain Donations: PayPal.

This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Login / Register


Or login with...
Sign in with Steam Sign in with Google
Social logins require cookies to stay logged in.

Buy Games
Buy games with our affiliate / partner links: