aboutsummaryrefslogtreecommitdiffstats
path: root/bin/get-inhibit-idle-status.sh
blob: 9c74c4e09e1491c3fee3843270cd63b5dbff3302 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
set -uo pipefail

changescript="$(pidof "inhibit-idle.sh" || true)"
if [ -n "$changescript" ]; then
    wait "$changescript"
fi

idleprog="hypridle"

isactive="$(systemctl --user is-active $idleprog)"
if [ "$isactive" = "active" ]; then
  echo "{\"text\": \"running\", \"alt\": \"running\", \"tooltip\": \"$idleprog is running\", \"class\": \"running\" }"
else
  echo "{\"text\": \"suspended\", \"alt\": \"suspended\", \"tooltip\": \"$idleprog is suspended\", \"class\": \"suspended\" }"
fi