summaryrefslogtreecommitdiff
path: root/polybar/scripts/awake-status.sh
blob: 98948f2ef0f57ce86c0e19b7b97717e104867d8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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