mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +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
|
||||||
|
kill -STOP "$pid"
|
||||||
|
notify-send "Idle-Toggle" "Idle timeouts disabled"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
swayidle & disown
|
notify-send "Idle-Toggle" "$idleprog not running!"
|
||||||
notify-send "Idle" "Idle timeouts enabled"
|
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue