| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | PROCESS="hypridle" |
| 6 | |
| 7 | if [[ "$1" == "status" ]]; then |
| 8 | sleep 1 |
| 9 | if pgrep -x "$PROCESS" >/dev/null; then |
| 10 | echo '{"text": "RUNNING", "class": "active", "tooltip": "idle_inhibitor NOT ACTIVE\nLeft Click: Activate\nRight Click: Lock Screen"}' |
| 11 | else |
| 12 | echo '{"text": "NOT RUNNING", "class": "notactive", "tooltip": "idle_inhibitor is ACTIVE\nLeft Click: Deactivate\nRight Click: Lock Screen"}' |
| 13 | fi |
| 14 | elif [[ "$1" == "toggle" ]]; then |
| 15 | if pgrep -x "$PROCESS" >/dev/null; then |
| 16 | pkill "$PROCESS" |
| 17 | else |
| 18 | "$PROCESS" |
| 19 | fi |
| 20 | else |
| 21 | echo "Usage: $0 {status|toggle}" |
| 22 | exit 1 |
| 23 | fi |