Update toggle-idle to use hypridle

This commit is contained in:
ItsDrike 2024-02-19 01:56:00 +01:00
parent 59c3b49d33
commit c2564684da
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -1,9 +1,18 @@
#!/bin/sh #!/bin/bash
set -euo pipefail
if pgrep swayidle >/dev/null; then idleprog="hypridle" # or swayidle
killall swayidle
notify-send "Idle" "Idle timeouts disabled" 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 else
swayidle & disown kill -STOP "$pid"
notify-send "Idle" "Idle timeouts enabled" notify-send "Idle-Toggle" "Idle timeouts disabled"
fi
else
notify-send "Idle-Toggle" "$idleprog not running!"
fi fi