-
-
Save fourkbomb/bef48465d1d3e26edb0c to your computer and use it in GitHub Desktop.
Download random xkcd and use it as screensaver
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/sh | |
# this requires jshon, awk and sed | |
if ip addr | grep wlan0 | grep UP 2>&1 >/dev/null; then | |
# we have wifi | |
URL=$(curl http://c.xkcd.com/random/comic/ --dump-header - | grep Location | awk '{print $2}' | sed 's/\r//g') | |
JSON=`curl "$URL"info.0.json` | |
wget $(echo $JSON | jshon -e img | sed 's/"//g' | sed 's/\\//g') -O $HOME/.xkcd.png | |
fi | |
i3lock -i ~/.xkcd.png -c 000000 -t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment