Add an example script where Redshift determines daytime

This commit is contained in:
bimlas 2020-04-14 13:51:35 +02:00
parent f7db31d14e
commit 5499170bad
2 changed files with 24 additions and 0 deletions

View file

@ -45,3 +45,10 @@ to the settings (see later).
== Settings == Settings
For settings, open the XFCE Settings Editor -> `night-mode` channel. For settings, open the XFCE Settings Editor -> `night-mode` channel.
=== Switch at a time specified by antoher program
For example, to use http://jonls.dk/redshift/[Redshift] or another program to
determine when it is night, use `xfce4-night-mode-redshift.sh` (or a modified
version of it) instad of `xfce4-night-mode.sh` in "Generic Monitor plugin
usage".

17
xfce4-night-mode-redshift.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
# XFCE Night Mode controlled by Redshift
#
# https://gitlab.com/bimlas/xfce4-night-mode (main repository)
# https://github.com/bimlas/xfce4-night-mode (mirror, please star if you like the plugin)
if ( LC_ALL='C' redshift -vo 2> /dev/null | grep "Period: Daytime" > /dev/null ); then
mode='day'
else
mode='night'
fi
"$(dirname "$0")/xfce4-night-mode.sh" $mode | sed '/<tool>/,/<\/tool>/ d'
echo "<tool>
Night mode defined by RedShift
Click to toggle mode for a while
</tool>"