this post was submitted on 08 Oct 2023
55 points (100.0% liked)

Linux Gaming

15243 readers
86 users here now

Discussions and news about gaming on the GNU/Linux family of operating systems (including the Steam Deck). Potentially a $HOME away from home for disgruntled /r/linux_gaming denizens of the redditarian demesne.

This page can be subscribed to via RSS.

Original /r/linux_gaming pengwing by uoou.

Resources

WWW:

Discord:

IRC:

Matrix:

Telegram:

founded 1 year ago
MODERATORS
 

Hey all! If you do any gaming on Hyprland, you might be interested in hyprfreeze.

It's a very simple bash script I made to "freeze" a game process (or any other process) in Hyprland, which you may find useful to:

  • Pause games during unpausable cutscenes
  • Save system resources (CPU and GPU are free, the process is saved in RAM)

Should just work^^TM in most scenarios but my testings can only go so far and any feedback would be very appreciated.

top 9 comments
sorted by: hot top controversial new old
[–] [email protected] 5 points 1 year ago (1 children)

Does this mean I can pause online games?

/s

/us I'm assuming this is like pressing Ctrl+Z in a Terminal window, and then fg to unpause.

[–] [email protected] 6 points 1 year ago

Haha, yes! Ctrl+Z sends a TSPT signal to a terminal process, while this script sends a STOP signal to every process in a game's process tree. Both get resumed with a SIGCONT so they're kinda similar.

[–] [email protected] 3 points 1 year ago (1 children)

Does it work on Wayland compositors that aren't hyprland?

[–] [email protected] 3 points 1 year ago (1 children)

No, it uses hyprctl to get the pid of the current active window. Which compositor are you using? It might be possible to get the pid in a different way.

[–] [email protected] 1 points 1 year ago (1 children)

Qtile and mutter, I have 2 computers

[–] [email protected] 1 points 1 year ago

I'm not familiar with qtile, but I'm fairly sure there's currently no way to get information about the active window on mutter unfortunately.

Thing with wayland is, each compositor has to implement things their own way, so you're limited to what your compositor allows you to do.

For instance, you can get window information in sway with swaymsg. On other compositors you may have to find workarounds.

[–] [email protected] 2 points 1 year ago (1 children)

That's cool! Do you know about any similar solution for KDE Plasma/Kwin by any chance? Also, would it be theoretically possible to save the process to some kind of swapfile on disk so it doesn't take up space in RAM?

[–] [email protected] 4 points 1 year ago* (last edited 1 year ago)

There is Nyrna, but it doesn't work on Wayland.

Afaik saving to swap isn't possible as it's something managed by the kernel, although you can try tweaking cgroups. Nyrna also mentions that this isn't currently possible.

[–] [email protected] 2 points 1 year ago

Pretty simple and elegant solution. Nice job!