Unimatrix script for seasonal variations

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

2 Likes

That is pretty cool!

1 Like