2024-10-02 12:37:28 +00:00
|
|
|
#!/usr/bin/env bash
|
2024-02-19 00:56:00 +00:00
|
|
|
set -euo pipefail
|
2022-10-30 18:33:47 +00:00
|
|
|
|
2024-02-19 00:56:00 +00:00
|
|
|
idleprog="hypridle" # or swayidle
|
|
|
|
|
|
|
|
pid="$(pidof "$idleprog" || true)"
|
|
|
|
if [ -n "$pid" ]; then
|
|
|
|
# is process suspended?
|
|
|
|
if ps -o stat= -p "$pid" | grep T >/dev/null; then
|
|
|
|
kill -CONT "$pid"
|
|
|
|
notify-send "Idle-Toggle" "Idle timeouts enabled"
|
|
|
|
else
|
|
|
|
kill -STOP "$pid"
|
|
|
|
notify-send "Idle-Toggle" "Idle timeouts disabled"
|
|
|
|
fi
|
2022-10-30 18:33:47 +00:00
|
|
|
else
|
2024-02-19 00:56:00 +00:00
|
|
|
notify-send "Idle-Toggle" "$idleprog not running!"
|
2022-10-30 18:33:47 +00:00
|
|
|
fi
|