diff --git a/dot_local/bin/executable_caffeine b/dot_local/bin/executable_caffeine index fbab06c106d81d3945b1339c20c086d3738017ad..a4bb942accf085e6622b0f6b66826399431a0b2c 100644 --- a/dot_local/bin/executable_caffeine +++ b/dot_local/bin/executable_caffeine @@ -1,5 +1,7 @@ #!/usr/bin/env bash +export DISPLAY="${DISPLAY:-:0}" + STATE_FILE="$XDG_CACHE_HOME/caffeine_state" PID_FILE="$XDG_CACHE_HOME/caffeine.pid" @@ -23,12 +25,12 @@ toggle) sleep infinity & echo $! >"$PID_FILE" touch "$STATE_FILE" - xset -dpms s off s noblank + xset -dpms s off notify-send "Caffeine on" "System will stay awake." fi ;; status) - if [ -n "$(caffeine_pid)" ]; then + if xset q 2>/dev/null | grep -q "DPMS is Disabled"; then echo "󰅶" else echo "󰾪"