Skip to content

Instantly share code, notes, and snippets.

@lesliesrussell
Created April 11, 2019 03:46
Show Gist options
  • Save lesliesrussell/a600eb5ce6dcd681f05bafe0c422da7d to your computer and use it in GitHub Desktop.
Save lesliesrussell/a600eb5ce6dcd681f05bafe0c422da7d to your computer and use it in GitHub Desktop.
#!/bin/bash
FONT_COLOR=$(shuf -n 1 ~/.motd/colors)
FONT_STROKE=$(shuf -n 1 ~/.motd/colors)
GRAVITY=$(shuf -n 1 ~/.motd/gravity)
WEIGHT=$(shuf -i05-20 -n1)
SIZE=$(shuf -i20-100 -n1)
FONT=$(randomfont)
QUOTE=$(randommotd)
MONTH=$(date --date=now +%B)
NIGHT_PAPERS=~/Pictures/wallpaper/"$MONTH"/night/*
DAY_PAPERS=~/Pictures/wallpaper/"$MONTH"/day/*
if [ $(( $(date --date=now +10#%H) )) -gt 06 ] && [ $(( $(date --date=now +10#%H) )) -lt 19 ]
then
WALLPAPER_DIR=$DAY_PAPERS
else
WALLPAPER_DIR=$NIGHT_PAPERS
fi
ARRAY=($WALLPAPER_DIR)
N1=$((RANDOM % $(ls -l $WALLPAPER_DIR | grep -v ^d | wc -l)))
WALLPAPER=${ARRAY[$N1]}
# wal -i $WALLPAPER && killall -USR1 compton /dev/null 2>&1
wal -i $WALLPAPER && killall -USR1 compton >~/.randomwal.log
ORIGWAL=$(cat ~/.cache/wal/wal)
# gencalwal > /dev/null 2>/dev/null
# sleep 5
convert $ORIGWAL -resize 1920x1080! -gravity $GRAVITY -weight "$WEIGHT" -pointsize "$SIZE" -font $FONT -fill $FONT_COLOR -stroke $FONT_STROKE -strokewidth 3 -annotate +25+25 "$QUOTE" /tmp/output.png
# -spread 1 -blur 0x1
# echo $FONT
# echo $FONT_COLOR
# echo $FONT_STROKE
# echo $QUOTE
# echo $GRAVITY
# echo $WEIGHT
$(feh --bg-fill /tmp/output.png)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment