X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=.bin%2Fredshift-check;h=b90eadb0c4b23b2896e0ab856b1e7e3aec9ac839;hb=53756ed8612888ef97a5c39a83e9ceaaed56ac91;hp=c41e4360ad9e7e2ddec8376f2e7794e6768375c4;hpb=7d9d78aa0b4e694dc896ced0a910c271effc1dac;p=home.git diff --git a/.bin/redshift-check b/.bin/redshift-check index c41e436..b90eadb 100755 --- a/.bin/redshift-check +++ b/.bin/redshift-check @@ -5,7 +5,7 @@ usage() { Usage: ${0##*/} [options] Options: - --reset reset display to no redshift + -x, --reset reset display to no redshift EOF if [[ $# -eq 0 ]] ; then @@ -21,12 +21,17 @@ rs() { } main() { - cd + cd / export DISPLAY=:0 + local auth="${HOME}/.Xauthority" + if [[ -e ${auth} ]]; then + export XAUTHORITY=${auth} + fi + while [[ $# -gt 0 ]] ; do case $1 in - --reset) rs -x ;; + -x|--reset) rs -x ;; -h|--help) usage ;; *) usage "Unknown option: $1" ;; esac @@ -35,21 +40,22 @@ main() { h=$(date +%H) declare -A temps + local min=2000 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 + [20]=$(( min + 2000 )) + [21]=$(( min + 1500 )) + [22]=$(( min + 1000 )) + [23]=$(( min + 500 )) + [00]=$(( min )) + [01]=$(( min )) + [02]=$(( min )) + [03]=$(( min )) + [04]=$(( min )) + [05]=$(( min )) + [06]=$(( min + 500 )) + [07]=$(( min + 1000 )) + [08]=$(( min + 1500 )) + [09]=$(( min + 2000 )) ) t=${temps[${h}]}