adaptive sync

This commit is contained in:
nnduc
2026-10-19 23:21:54 +07:00
parent 9b8320cead
commit 96467a1c56
15 changed files with 169 additions and 848 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# Freeze / resume the focused window's process tree (SIGSTOP / SIGCONT).
pid=$(xdotool getactivewindow getwindowpid 2>/dev/null) || exit 1
# collect pid plus all descendants (Wine/Proton games spawn several)
descendants() {
local p
for p in $(pgrep -P "$1"); do
echo "$p"
descendants "$p"
done
}
pids="$pid $(descendants "$pid")"
name=$(ps -o comm= -p "$pid")
case "$(ps -o state= -p "$pid")" in
T*) kill -CONT $pids && notify-send -t 1500 "Resumed" "$name ($pid)" ;;
*) kill -STOP $pids && notify-send -t 1500 "Frozen" "$name ($pid)" ;;
esac