Skip to content

Instantly share code, notes, and snippets.

@AriTheElk
Last active November 11, 2019 19:17
Show Gist options
  • Save AriTheElk/e4f1aa6e82ef39da18f4f7ad9ea97330 to your computer and use it in GitHub Desktop.
Save AriTheElk/e4f1aa6e82ef39da18f4f7ad9ea97330 to your computer and use it in GitHub Desktop.
increase/decreate Gnome's night light temperature from the command line
#!/bin/bash
TEMP_MIN=1000
TEMP_MAX=10000
RAW_TEMPERATURE=$(gsettings get org.gnome.settings-daemon.plugins.color night-light-temperature)
COLOR_TEMP=${RAW_TEMPERATURE//uint32/}
GRANULARITY=500
if [ $# -eq 0 ]
then echo "NO ARGUMENT!"
else
if [ $1 == "increase" ]
then COLOR_TEMP=$(expr $COLOR_TEMP - $GRANULARITY)
elif [ $1 == "decrease" ]
then COLOR_TEMP=$(expr $COLOR_TEMP + $GRANULARITY)
fi
fi
# TODO: automatically disable night light when turned to a normal temp
if [ $COLOR_TEMP -lt $TEMP_MIN ]
then COLOR_TEMP=$TEMP_MIN
elif [ $COLOR_TEMP -gt $TEMP_MAX ]
then COLOR_TEMP=$TEMP_MAX
fi
gsettings set org.gnome.settings-daemon.plugins.color night-light-temperature $COLOR_TEMP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment