summaryrefslogtreecommitdiff
path: root/polybar/scripts/awake-status.sh
diff options
context:
space:
mode:
authorDavid Moc <personal@cdatgoose.org>2026-05-24 11:48:07 +0200
committerDavid Moc <personal@cdatgoose.org>2026-05-24 11:48:07 +0200
commit5fb19f10389b70ee2389755106092a9ef6c64598 (patch)
tree969eb0466de581cb14aa09f751a95138620fc720 /polybar/scripts/awake-status.sh
Go
Diffstat (limited to 'polybar/scripts/awake-status.sh')
-rwxr-xr-xpolybar/scripts/awake-status.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/polybar/scripts/awake-status.sh b/polybar/scripts/awake-status.sh
new file mode 100755
index 0000000..98948f2
--- /dev/null
+++ b/polybar/scripts/awake-status.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+state_dir="${XDG_RUNTIME_DIR:-/tmp}"
+if [ ! -w "$state_dir" ]; then
+ state_dir="${XDG_CACHE_HOME:-$HOME/.cache}"
+fi
+if [ ! -w "$state_dir" ]; then
+ state_dir="/tmp"
+fi
+state_file="$state_dir/polybar-awake.state"
+
+if [ -f "$state_file" ]; then
+ echo "%{F#98971a}on%{F-}"
+else
+ echo "%{F#928374}off%{F-}"
+fi