File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44# https://gitlab.com/bimlas/xfce4-night-mode (main repository)
55# https://github.com/bimlas/xfce4-night-mode (mirror, please star if you like the plugin)
66
7- if ( LC_ALL=' C' redshift -p 2> /dev/null | grep ' Period: Night' > /dev/null ); then
8- mode=' night'
9- else
10- mode=' day'
11- fi
7+ # Change this variable to define which mode to use while RedShift transitions from day to night or vice versa
8+ # Choices: night|day
9+ TRANSITION_MODE=' night'
10+
11+ redshift_period=$( LC_ALL=' C' redshift -p 2> /dev/null | grep -E ' ^Period: ' | grep -Eo ' (Transition|Night|Day)' )
12+
13+ case $redshift_period in
14+ " Day" )
15+ mode=' day'
16+ ;;
17+
18+ " Night" )
19+ mode=' night'
20+ ;;
21+
22+ " Transition" )
23+ if [ $TRANSITION_MODE ]; then
24+ if [[ $TRANSITION_MODE =~ (day| night) ]]; then
25+ mode=$TRANSITION_MODE
26+ else
27+ echo ' Invalid value set for $TRANSITION_MODE!'
28+ fi
29+ else
30+ echo ' RedShift transition period detected but $TRANSITION_MODE is not set. Set $TRANSITION_MODE to define which mode to use during transition periods.'
31+ fi
32+ ;;
33+
34+ * )
35+ echo " Could not determine RedShift period: $redshift_period "
36+ ;;
37+ esac
1238
1339" $( dirname " $0 " ) /xfce4-night-mode.sh" " $mode " | sed ' /<tool>/,/<\/tool>/ d'
1440echo ' <tool>
You can’t perform that action at this time.
0 commit comments