mirror of
https://github.com/ItsDrike/nixdots
synced 2025-06-30 10:20:43 +00:00
Add toggle-idle script
This commit is contained in:
parent
b3f457340d
commit
083dc759d1
5 changed files with 35 additions and 0 deletions
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
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
|
||||
notify-send "Idle-Toggle" "$idleprog not running!"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue