aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/setbg22
1 files changed, 20 insertions, 2 deletions
diff --git a/bin/setbg b/bin/setbg
index 805cb9e..1eacbd3 100755
--- a/bin/setbg
+++ b/bin/setbg
@@ -1,2 +1,20 @@
-#!/bin/sh
-if [ -f ~/.bg.png ]; then feh --bg-max -B white ~/.bg.png; fi
+#!/bin/bash
+
+SCR_WIDTH=1980
+SCR_HEIGHT=1080
+PADDING=50
+let "SCR_WIDTH -= 2 * $PADDING"
+let "SCR_WIDTH /= 2"
+let "SCR_HEIGHT -= 2 * $PADDING"
+
+NR=$RANDOM
+let "NR %= 524"
+
+wget -qO- "http://pgfplots.sourceforge.net/example_$NR.pdf" | convert -density 300 - /tmp/bg.png
+wget -qO- "http://pgfplots.sourceforge.net/gallery.html" | sed -n "/example_$NR\.pdf/,/<\/div>/p" | tail -n +6 | head -n -1 | pygmentize -l latex -O font_size=24 -o /tmp/bg-src.png
+
+montage -geometry "${SCR_WIDTH}x$SCR_HEIGHT+$PADDING+$PADDING" /tmp/bg-src.png /tmp/bg.png /tmp/bg.png
+rm /tmp/bg-src.png
+
+feh -B white --bg-max /tmp/bg.png
+