blob: 0ef6e34b304933409a1335748a2074a35ceef453 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/bin/bash
# dotfiles -- scripts/redshift.sh
# author: johannst
# Didn't find a way to query current temperature.
# Use a file to keep track
VALUE_FILE=~/.redshift
function setRedshift() {
# 6500K default temp
local val=${1:-6500}
echo "$val" > $VALUE_FILE
redshift -P -O $val &> /dev/null
}
[[ ! -f $VALUE_FILE ]] && setRedshiftFile
curr_val=$(<$VALUE_FILE)
case $BLOCK_BUTTON in
3) setRedshift ;; # right click, set default
4) setRedshift $((curr_val + 200)); ;; # scroll up, inc temp (more blue)
5) setRedshift $((curr_val - 200)); ;; # scroll down, dec temp (more red)
esac
new_val=$(<$VALUE_FILE)
# format protocol (https://github.com/vivien/i3blocks/tree/master/docs#format)
echo ${new_val}K
echo ""
if [ $new_val -lt 5000 ]; then
echo "#eba02f"
elif [ $new_val -gt 7500 ]; then
echo "#42adff"
fi
|