From: Mike Frysinger Date: Thu, 7 Aug 2014 04:26:37 +0000 (+0900) Subject: globalize redshift X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=bd3d583641abf9495e2a186e7426c191a1806e14;p=home.git globalize redshift --- diff --git a/.bin/redshift-check b/.bin/redshift-check index a749406..c994ad0 100755 --- a/.bin/redshift-check +++ b/.bin/redshift-check @@ -1,8 +1,34 @@ -#!/bin/sh +#!/bin/bash +cd +export DISPLAY=:0 + +case $1 in +--reset) exec redshift -x ;; +esac + h=$(date +%H) -if [ ${h#0} -lt 10 -o ${h#0} -ge 21 ]; then - (pgrep -f /usr/bin/redshift >/dev/null 2>&1 || DISPLAY=:0 exec /usr/bin/redshift -l 42:-71) & + +declare -A temps +temps=( + [20]=5000 + [21]=4500 + [22]=4000 + [23]=3500 + [00]=3000 + [01]=3000 + [02]=3000 + [03]=3000 + [04]=3000 + [05]=3000 + [06]=3500 + [07]=4000 + [08]=4500 + [09]=5000 +) + +t=${temps[${h}]} +if [[ -z ${t} ]]; then + exec redshift -x else - killall -q redshift + exec redshift -O ${t}k fi -: