Created
May 25, 2017 15:09
-
-
Save fsmithred/7d0722131bfedd5457c6e70ba6585327 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# redshifty | |
# run one-shot redshift with desired settings | |
LOGFILE="/tmp/redshifty.log" | |
# set limits here. | |
MINT="3800" | |
MAXT="7800" | |
MINB="0.20" | |
MAXB="1.00" | |
temp0=$(cut -d" " -f1 "$LOGFILE") | |
bright0=$(cut -d" " -f2 "$LOGFILE") | |
settings=$(yad --form --field=Temp:NUM --field=Bright:NUM \ | |
"$temp0!$MINT..$MAXT!100" "$bright0!0.20..1.00!0.05!2" \ | |
--title redshifty --separator=" " \ | |
--text="Set Temp between $MINT and $MAXT\nSet Bright between $MINB and $MAXB \n") | |
ret="$?" | |
if [[ $ret -eq 1 ]] ; then | |
exit 0 | |
fi | |
echo "$settings" > "$LOGFILE" | |
temp=$(echo $settings | cut -d" " -f1) | |
bright=$(echo $settings | cut -d" " -f2) | |
if [[ "$temp" -lt "$MINT" ]] ; then | |
TEMP="$MINT" | |
elif [[ "$temp" -gt "$MAXT" ]] ; then | |
TEMP="$MAXT" | |
else | |
TEMP="$temp" | |
fi | |
if [[ "$bright" < "$MINB" ]] ; then | |
BRIGHT="$MINB" | |
elif [[ "$bright" > "$MAXB" ]] ; then | |
BRIGHT="$MAXB" | |
else | |
BRIGHT="$bright" | |
fi | |
redshift -O "$TEMP" -b "$BRIGHT" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment