This repository has been archived on 2024-09-01. You can view files and clone it, but cannot push or open issues or pull requests.
al-skel/home/.config/polybar/scripts/redshift
2017-10-23 16:35:35 -07:00

37 lines
794 B
Bash
Executable File

#!/usr/bin/env bash
#Usage : redshift.sh [toggle]
START='redshift'
STOP="killall redshift"
if [[ "$@" = *toggle* ]]; then
if pgrep redshift > /dev/null
then
$STOP
else
$START &
fi
fi
# Specifying the icon(s) in the script
# This allows us to change its appearance conditionally
icon=""
pgrep -x redshift &> /dev/null
if [[ $? -eq 0 ]]; then
temp=$(redshift -p 2>/dev/null | grep temp | cut -d' ' -f3)
temp=${temp//K/}
fi
# OPTIONAL: Append ' ${temp}K' after $icon
if [[ -z $temp ]]; then
echo " $icon " # Greyed out (not running)
elif [[ $temp -ge 5000 ]]; then
echo "%{F#6BA4E7} $icon " # Blue
elif [[ $temp -ge 4000 ]]; then
echo "%{F#F9F1AF} $icon " # Yellow
else
echo "%{F#E7816B} $icon " # Orange
fi