mirror of
https://github.com/Zerodya/hyprfreeze.git
synced 2024-11-09 17:08:49 +01:00
First commit
This commit is contained in:
parent
a1612a3817
commit
eb7a531571
2 changed files with 27 additions and 1 deletions
12
README.md
12
README.md
|
@ -1,2 +1,12 @@
|
|||
# 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
16
hyprfreeze
Normal 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
|
Loading…
Reference in a new issue