aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorCamil Staps2016-04-06 22:17:29 +0200
committerCamil Staps2016-11-30 19:11:08 +0100
commit65223eb4555e7f2a5b64c20f4df19a79cc4f0013 (patch)
tree09b886df5bea90891c7675061b6551addb3a7568 /bin
parentFixed nowplaying order (diff)
pgfplot example as background
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
+