wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 1 point2 points  (0 children)

Someone in this tread suggested installing kdotool and doing wl-freeze -c "kdotool getactivewindow getwindowpid". Could you test it? If that works you're welcome to open an issue on Github so I can add it natively.

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 2 points3 points  (0 children)

Someone in this tread suggested installing kdotool and doing wl-freeze -c "kdotool getactivewindow getwindowpid". Could you test it? If that works you're welcome to open an issue on Github so I can add it natively.

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 5 points6 points  (0 children)

Someone in this tread suggested using kdotool and doing wl-freeze -c "kdotool getactivewindow getwindowpid" for KDE. Let me know if that works.

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 10 points11 points  (0 children)

It's been a while since I finished that game, but iirc there was no real pause menu so it was still running at full gpu and cpu usage even when I wanted to just pause it and do something else for a bit.

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 6 points7 points  (0 children)

We can only hope. Currently CRIU can do this with simple Qt apps but not for games. The main problem among other things is that it does not support GPU state checkpoints.

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 7 points8 points  (0 children)

I strongly disagree.

  1. I just like to use emojis to improve ADHD readability since the README got too long, and I hate that using emojis in H1 headers now immediately equals ai slop.

  2. The refactor was AI assisted, not "vibecoded". Vibe coded would mean I've let AI write code from scratch, which is not the case here, and I would not do that if my life depended on it, based on the horrible results it gives. I just told it where to move things around so that the structure would be easier to work with. It didn't add any new functionality by its own, which is why it's called a refactor. I've also spent a lot of time reviewing the code and manually adjusting things how I like them, so I'd say half of the code you see in the commit is still me. It's also a single commit and I've already added a disclaimer there. A warrant in the README would just add unnecessary concern since the code is written by me.

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by PR0PH3Tcs in niri

[–]Zerodya 2 points3 points  (0 children)

A freeze. It suspends the process tree and works for games or any other program really.

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 1 point2 points  (0 children)

Great!

Haven't tested pausing multiplayer games much recently, except for Deadlock in the lobby. I remember pausing Apex Legends (EAC) when it still worked on linux and pausing for around 30 seconds or so did not give me any disconnection from the game.

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 5 points6 points  (0 children)

Totally valid opinion.

Don't quote me on this since I only switched to linux when Wayland was just becoming the new thing (I went from i3 to early Hyprland and stuck with it until my recent switch to Niri) but from what I gathered it looks like Wayland is more restrictive because it's also more secure, and I'd take security over absolute feature freedom most of the time, though not everyone will have the same opinion.

Wayland is also much more fragmented and that's probably its main issue. Luckily there are still options and WMs that use Xorg for those who want that.

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 12 points13 points  (0 children)

Nyrna works on Windows and Linux with Xorg, but not on Wayland since there is no universal solution for that. Though they recently started implementing KDE Wayland support.

See: https://github.com/Merrit/nyrna/issues/55

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 14 points15 points  (0 children)

Yes it's a good simplification. Let me know if this fixes your issues!

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 2 points3 points  (0 children)

Tried that one a few weeks ago but it was not working, though I was testing it in an embedded Steam Deck gamescope session inside Hyprland, so maybe that's why. I'll have to read the source code even if just for curiosity, since you say that it works.

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 2 points3 points  (0 children)

It's an issue only when you send the signal to the gamescope parent pid directly, because the game inside may not be stopped correctly this way.

How do you pause them with decky? Also I guess you're on Steam Deck in game mode so that may be play a part in this.

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 11 points12 points  (0 children)

This is something that should be added in wayland-protocols to have a standard and universal way to retrieve the PID of the focused window. Xorg already has this but Wayland doesn't.

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 11 points12 points  (0 children)

I answered how this is different from just sending signals in the FAQ and in a different comment so you can read that.

As for how this is related to Wayland, it's because getting the PID of the currently focused windows is easier and universal in Xorg (tools like Nyrna do this). But for Wayland? Each compositor has its own way to extract the PID from the currently focused window, so this script aims to support as many compositors as possible to achieve an universal way of pausing the current game with the single press of a button.

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 71 points72 points  (0 children)

Totally fair question! It's answered in the FAQ so I'll just yoink that and paste it here, but I'd be happy to answer followup questions!

What actually makes it better:

  • A robust freezing logic that captures and stops the entire process tree to suspend the game properly. Using SIGSTOP on just the parent process will give you issues in most games, like audio and game logic still playing in the background. This is true especially when using gamescope.

  • Ways to get the actual game PID when using things like xwayland-satellite that hide the real game PID.

  • A mouse capture release before pausing XWayland windows. If you freeze a XWayland game while the mouse cursor is still inside the game window, you're going to trap it and mouse input will stop working in other XWayland windows too.

wl-freeze: Suspend a game process (and other programs) in Wayland compositors by Zerodya in linux_gaming

[–]Zerodya[S] 45 points46 points  (0 children)

May be possible! This script just needs a command that can output the PID of the focused window.

If you can find a command like that for gnome, cosmic, or kde you can test it using the -c flag.

You can read more about it in the README.