2023-09-02 18:18:38 +02:00
# hyprfreeze
2024-02-11 18:05:37 +01:00
[![basher install ](https://www.basher.it/assets/logo/basher_install.svg )](https://www.basher.it/package/)
2024-02-13 16:38:07 +01:00
Hyprfreeze is a utility to suspend a game process (and other programs) in Hyprland and Sway.
2023-10-13 12:40:12 +02:00
2024-02-11 12:49:19 +01:00
https://github.com/Zerodya/hyprfreeze/assets/73220426/541318e2-441a-485a-91c5-f58d4f65926a
**Useful to:**
2024-02-10 22:48:08 +01:00
- Pause single-player games that can't normally be paused (Elden Ring, Baldur's Gate 3, ...)
- Pause cutscenes to read the subtitles or if you suddenly need to leave your desk
2023-10-13 12:40:12 +02:00
- Save system resources (excluding RAM) if you need them for another computer task, or if the game's pause menu uses too many
2024-02-11 12:49:19 +01:00
**Note:** Running games in [**gamescope** ](https://github.com/ValveSoftware/gamescope ) is highly recommended. (See [#1 ](https://github.com/Zerodya/hyprfreeze/issues/1 ))
2024-02-10 22:48:08 +01:00
2023-10-13 12:40:12 +02:00
## Installation
### Arch Linux
2023-10-14 18:43:37 +02:00
Hyprfreeze is available in [AUR ](https://aur.archlinux.org/packages/hyprfreeze-git ).
2023-10-13 12:40:12 +02:00
### Dependencies
2024-02-11 17:56:12 +01:00
- a compatible window manager (`hyprland` or `sway` ) to get the PID of the active window
2024-02-10 22:48:08 +01:00
- `jq` to parse json
- `psmisc` contains 'pstree' which is required to list child processes
### Optional
2024-02-13 02:07:02 +01:00
- [`hyprprop` ](https://github.com/vilari-mickopf/hyprprop ) or [`swayprop` ](https://git.alternerd.tv/alterNERDtive/swayprop ) to get the pid of a window by selecting it with your mouse
2024-02-10 22:48:08 +01:00
### Highly Recommended
- [`gamescope` ](https://github.com/ValveSoftware/gamescope ) fixes mouse input not working in other XWayland windows after pausing a Wine game. It's also the superior way to game in Wayland anyway.
2023-10-13 12:40:12 +02:00
2024-02-11 18:05:37 +01:00
### Basher
Hyprfreeze is compatible with shell script package manager [Basher ](https://basher.it ).
```bash
basher install Zerodya/hyprfreeze
```
2023-10-13 12:40:12 +02:00
### Manual
Clone this repo and symlink the `hyprfreeze` script to a directory in your `PATH` :
```bash
2024-02-17 13:29:12 +01:00
git clone https://github.com/Zerodya/hyprfreeze.git Hyprfreeze
ln -s $(pwd)/Hyprfreeze/hyprfreeze $HOME/.local/bin
2023-10-13 12:40:12 +02:00
```
## Usage
2024-02-11 17:56:12 +01:00
Add a bind in your Hyprland or Sway config to pause the current active window:
2024-02-17 13:29:12 +01:00
```bash
2023-10-13 12:40:12 +02:00
# ~/.config/hypr/hyprland.conf
...
# Toggle freeze on active window
2023-10-20 18:33:34 +02:00
bind = , PAUSE, exec, hyprfreeze -a
2023-09-02 18:58:22 +02:00
```
2023-10-13 12:40:12 +02:00
### Available flags
2023-09-02 18:58:22 +02:00
```
2023-10-20 18:33:34 +02:00
-h, --help show help message
2024-02-10 22:48:08 +01:00
2024-02-13 19:29:49 +01:00
-a, --active toggle suspend by active window
2024-02-10 22:48:08 +01:00
-p, --pid toggle suspend by process id
-n, --name toggle suspend by process name/command
2024-02-13 19:29:49 +01:00
-r, --prop toggle suspend by clicking on window (hyprprop/swayprop must be installed)
2024-02-10 22:48:08 +01:00
2023-10-20 18:33:34 +02:00
-s, --silent don't send notification
2023-12-06 14:35:47 +01:00
-t, --notif-timeout notification timeout in milliseconds (default 5000)
2023-10-20 18:33:34 +02:00
--info show information about the process
2023-12-06 14:35:47 +01:00
--dry-run doesn't actually suspend/resume a process, useful with --info
2024-02-10 22:48:08 +01:00
--debug enable debug mode
2023-10-13 12:40:12 +02:00
```
### Examples:
2024-02-17 13:29:12 +01:00
```bash
2023-10-13 12:40:12 +02:00
# Pause game by process name
hyprfreeze -n eldenring.exe
```
2024-02-17 13:29:12 +01:00
```bash
2023-10-13 12:40:12 +02:00
# Get info about a process by clicking on its window, without suspending it
hyprfreeze -r --info --dry-run
```
## Disclaimer
There is always the risk, although slim, that an application may crash.
This is intrinsically related to modifying running processes and is not something that Hyprfreeze can prevent.
Please make sure to **save your data** before using hyprfreeze.