Hello
I created a Unimatrix (improved cmatrix) scripts that changes the screensaver according to seasonal events.
The following special modes are included:
- Winter: Blue snowy theme
- Easter: Green spring theme
- Solstice: Yellow summer theme
- Vacation: Cyan leasure theme
- Halloween: Purple spooky theme
- Christmas: Red cozy theme
- New Year: Rainbow confetti on 12/31 and 01/01 (takes some CPU though)
The default mode is green matrix display.
The script needs Unimatrix installed as well as ncal
(to calculate date of easter) and cmatrix
(for New Years display).
Iām using it as a tmux screensaver with the following command:
set -g lock-command "/home/am/bash/unimatrix.sh ; vlock"
This first displays the screensaver, then followed by a lock screen (vlock).
Here is the script and screenshots:
#!/bin/bash
# Current date
now=$( date )
# Manual override
#now=$( date -d 12/31/2022 )
# Define variables
nowweek=$( date -d "$now" +%V )
nowdate=$( date -d "$now" +%x )
# Manual, because of bug in date conversion
[[ "$nowweek" == "07" ]] && (( nowweek = 7 ))
[[ "$nowweek" == "08" ]] && (( nowweek = 8 ))
easter=$( date -d "$(ncal -e)" +%V )
# Set season thresholds (week number)
(( wistar = 7 ))
(( wistop = 8 ))
(( eastar = easter ))
(( eastop = easter + 1 ))
(( sostar = 25 ))
(( sostop = 26 ))
(( vastar = 32 ))
(( vastop = 34 ))
(( hastar = 43 ))
(( hastop = 44 ))
(( chstar = 51 ))
(( chstop = 52 ))
# Debugging info
if [[ 1 == 0 ]]
then
echo "$now"
echo "$nowweek"
echo "${nowdate%/*}"
echo "$eastar"
echo "$eastop"
echo "$vastar"
echo "$vastop"
fi
# Display rainbow confetti on 12/31 and 01/01
if [[ "${nowdate%/*}" == "12/31" || "${nowdate%/*}" == "01/01" ]]
then
cmatrix -bar
else
# Define season from current date
(( nowweek >= wistar && nowweek <= wistop )) && season="winter"
(( nowweek >= eastar && nowweek <= eastop )) && season="easter"
(( nowweek >= sostar && nowweek <= sostop )) && season="solstice"
(( nowweek >= vastar && nowweek <= vastop )) && season="vacation"
(( nowweek >= hastar && nowweek <= hastop )) && season="halloween"
(( nowweek >= chstar && nowweek <= chstop )) && season="christmas"
# Override season with parameter
[[ -n "$1" ]] && season="$1"
# Display according to season
case "$season" in
christmas)
unimatrix -a -s 95 -c red -u 'āŗā»ā”ā„āāāāā¼āā«āŖāāā
āā
ā£āāā
āā
ā£' -l sun
;;
winter)
unimatrix -a -s 95 -c blue -u 'āŗā»ā”ā„āāāāā¼āā«āŖāāā
āā
ā£āāā
āā
ā£' -l sun
;;
easter)
unimatrix -a -s 95 -c green -u 'āŗā»ā”ā„āāāāā¼āā«āŖāāāāµāæāāāāāµāæā' -l sun
;;
solstice)
unimatrix -a -s 95 -c yellow -u 'āŗā»ā”ā„āāāāā¼āā«āŖāāāāµāæāāāāāµāæā' -l sun
;;
vacation)
unimatrix -a -s 95 -c cyan -u 'āŗā»ā”ā„āāāāā¼āā«āŖāāā·āµā¬āÆāāā·āµā¬āÆ' -l sun
;;
halloween)
unimatrix -a -s 95 -c magenta -u 'āŗā»ā”ā„āāāāā¼āā«āŖā°ā±ā¢āµāØā¼ā°ā±ā¢āµāØā¼' -l sun
;;
*)
unimatrix -a -s 96
;;
esac
fi
Default
Winter
Easter
Solstice
Vacation
Halloween
Christmas
New Year