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

16 lines
377 B
Bash

#!/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