1
0
Fork 1
mirror of https://github.com/Zerodya/hyprfreeze.git synced 2024-09-19 23:43:18 +02:00

First commit

This commit is contained in:
Nicola 2023-09-02 18:58:22 +02:00 committed by GitHub
parent a1612a3817
commit eb7a531571
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View file

@ -1,2 +1,12 @@
# hyprfreeze # hyprfreeze
Pause and resume game/program process in Hyprland Simple bash script to pause a game process in Hyprland, allowing you to resume it later.
Useful to:
- Pause games during unskippable cutscenes and similar scenarios
- Save system resources (CPU and GPU are free, the process is saved in RAM)
(Also works for any other program; pauses the current active window)
### Usage
Make the script executable, then in your Hyprland config add a bind to the script e.g. :
```
bind = $mainMod, PAUSE, exec, ~/scripts/hyprfreeze
```

16
hyprfreeze Normal file
View file

@ -0,0 +1,16 @@
#!/bin/bash
PID=$(hyprctl activewindow | grep -i pid | awk -F "pid: " '{ print $2 }' | awk -F "," '{ print $1 }')
PIDS=$(pstree $PID -npl | grep -oP '(?<=\()[0-9]+(?=\))')
# Pause process if running
if [[ "$(ps -o state= $PID)" == S ]]; then
kill -STOP $PIDS
exit 0
fi
# Resume process if stopped
if [[ "$(ps -o state= $PID)" == T ]]; then
kill -CONT $PIDS
exit 0
fi