mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-25 20:54:34 +00:00
Update toggle-idle to use hypridle
This commit is contained in:
parent
59c3b49d33
commit
c2564684da
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue