-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathxfce4-night-mode-redshift.sh
More file actions
executable file
·43 lines (36 loc) · 1.18 KB
/
Copy pathxfce4-night-mode-redshift.sh
File metadata and controls
executable file
·43 lines (36 loc) · 1.18 KB
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
36
37
38
39
40
41
42
43
#!/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)
# Change this variable to define which mode to use while RedShift transitions from day to night or vice versa
# Choices: night|day
TRANSITION_MODE='night'
redshift_period=$( LC_ALL='C' redshift -p 2> /dev/null | grep -E '^Period: ' | grep -Eo '(Transition|Night|Day)' )
case $redshift_period in
"Day")
mode='day'
;;
"Night")
mode='night'
;;
"Transition")
if [ $TRANSITION_MODE ]; then
if [[ $TRANSITION_MODE =~ (day|night) ]]; then
mode=$TRANSITION_MODE
else
echo 'Invalid value set for $TRANSITION_MODE!'
fi
else
echo 'RedShift transition period detected but $TRANSITION_MODE is not set. Set $TRANSITION_MODE to define which mode to use during transition periods.'
fi
;;
*)
echo "Could not determine RedShift period: $redshift_period"
;;
esac
"$(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>'