Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- OUTFILE=$(mktemp --suffix=.tex)
- BASE_DATE=$(date --date=now +%Y-%m)
- RED_LETTER_DAY=$(date --date=now +%F)
- ORIGWAL=$(cat ~/.cache/wal/wal)
- CAL_COLOR=$(xrdb -query | grep *.color66 | awk -F# '{print $2}')
- # -----------------------------------------------------------
- # 'Here document containing the body of the generated script.
- (
- cat <<EOF
- \documentclass[convert={density=300,size=300x300,outext=.png}]{standalone}
- \usepackage{tikz}
- \usetikzlibrary{calendar}
- \begin{document}
- \color[HTML]{$CAL_COLOR}
- \begin{tikzpicture}
- \calendar (mycal) [dates=$BASE_DATE-01 to $BASE_DATE-last,week list];
- \draw[red] (mycal-$RED_LETTER_DAY) circle (4pt);
- \end{tikzpicture}
- \end{document}
- EOF
- ) > $OUTFILE
- # -----------------------------------------------------------
- pdf2png () {
- cd /tmp
- pdflatex -shell-escape $OUTFILE
- PNGOUT=$(echo $OUTFILE | sed 's/tex/png/g')
- convert $ORIGWAL $PNGOUT -gravity SouthEast -composite -format png -quality 90 output.png
- DEL_TMPS=$(echo $OUTFILE | sed 's/tex/\*/g')
- rm $DEL_TMPS
- }
- pdf2png
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement