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
|
||||
killall swayidle
|
||||
notify-send "Idle" "Idle timeouts disabled"
|
||||
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
|
||||
else
|
||||
swayidle & disown
|
||||
notify-send "Idle" "Idle timeouts enabled"
|
||||
notify-send "Idle-Toggle" "$idleprog not running!"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue