Created
July 30, 2017 19:25
-
-
Save kookjr/d5e6629c160720abe0d26021672a96f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Overlay bill due dates on desktop | |
# Use hints from this page | |
# https://www.reddit.com/r/linux4noobs/comments/2upg57/custom_cheat_sheet_wallpaper_anyone/ | |
# | |
DTPIC=/usr/share/backgrounds/System76-Fractal_Mountains-by_Kate_Hazen_of_System76.png | |
CURR_WALLPAPER=$HOME/Pictures/mywallpaper.png | |
if [ ! -f $DTPIC ] | |
then | |
echo "no desktop picture was specified" | |
exit 1 | |
fi | |
which due >/dev/null 2>&1 | |
if [ $? -ne 0 ] | |
then | |
echo "the program, due, is not in your path" | |
exit 1 | |
fi | |
TEMP_IMG=$(mktemp).png | |
OVERLAY_DATA=$(due | sed -E -e ':a;N;$!ba;s/\r{0,1}\n/\\n/g' -e 's/^ /\\ /') | |
convert \ | |
-font Courier-Bold \ | |
-fill white \ | |
-background none \ | |
-undercolor none -trim +repage \ | |
-pointsize 18 \ | |
-size 900x \ | |
"caption:$OVERLAY_DATA" \ | |
PNG32:$TEMP_IMG | |
convert \ | |
$DTPIC $TEMP_IMG \ | |
-gravity NorthEast \ | |
-geometry +50+50 \ | |
-composite $CURR_WALLPAPER | |
rm -f $TEMP_IMG | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment