This commit is contained in:
committer
2024-05-26 18:54:30 -05:00
parent 098dc51c50
commit bd972e7e9a

View File

@@ -74,13 +74,30 @@ rshift() {
cmd=$1 cmd=$1
fi fi
temperature_file="/tmp/temperature.txt"
if [ ${cmd} == "info" ] ; then if [ ${cmd} == "info" ] ; then
echo "{morning, day, evening, night, bedtime}" echo "{morning, day, evening, night, bedtime}"
elif [ ${cmd} == "show" ] ||
[ ${cmd} == "display" ]
; then
if [ -f "${temperature_file}" ] ; then
temperature=$(cat /tmp/temperature.txt)
else
temperature=n/a
fi
echo "${temperature}K"
elif
[ ${cmd} == "disable" ] ||
[ ${cmd} == "off" ]
; then
redshift -x
elif [ ${cmd} == "morning" ] ; then elif [ ${cmd} == "morning" ] ; then
temperature=4500 temperature=4500
elif elif
[ ${cmd} == "day" ] || [ ${cmd} == "day" ] ||
[ ${cmd} == "normal" ] || [ ${cmd} == "default" ] || [ ${cmd} == "off" ] ; then [ ${cmd} == "normal" ] ||
; then
temperature=6500 temperature=6500
elif [ ${cmd} == "evening" ] ; then elif [ ${cmd} == "evening" ] ; then
temperature=3500 temperature=3500
@@ -93,6 +110,7 @@ rshift() {
fi fi
echo "setting temperature to ${temperature}K" echo "setting temperature to ${temperature}K"
touch '${temperature}' > ${temperature_file}
redshift -P -O ${temperature} redshift -P -O ${temperature}
} }