helm/home/profiles/desktop/polybar/modules/redshift
2022-12-06 17:09:27 +10:00

22 lines
598 B
Bash
Executable file

#!/usr/bin/env bash
# Specifying the icon(s) in the script
# This allows us to change its appearance conditionally
pgrep -x redshift &> /dev/null
if [[ $? -eq 0 ]]; then
temp=$(redshift -p 2>/dev/null | grep temp | cut -d' ' -f3)
temp=${temp//K/}
fi
icon=""
# OPTIONAL: Append ' ${temp}K' after $icon
if [[ -z $temp ]]; then
echo "%{F#65737E}$icon" # Greyed out (not running)
elif [[ $temp -ge 5000 ]]; then
echo "%{F#8FA1B3}$icon" # Blue
elif [[ $temp -ge 4000 ]]; then
echo "%{F#EBCB8B}$icon" # Yellow
else
echo "%{F#D08770}$icon" # Orange
fi