coolant/hyprfreeze
2023-10-10 20:51:07 +03:00

16 lines
385 B
Bash

#!/usr/bin/env 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