Created
July 20, 2011 19:03
-
-
Save keis/1095660 to your computer and use it in GitHub Desktop.
uzbl slideshow
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 | |
static='slideshow' | |
queue='slideshow_temp' | |
uri="" | |
Zzz=5 | |
if [ -z "$UZBL_FIFO" ]; then | |
echo "$0: error: set UZBL_FIFO before running" | |
exit 2 | |
fi | |
function nextUri () { | |
if [ -s "$queue" ]; then | |
# pop the first item from the queue | |
read -r uri < "$queue" | |
sed -i '1d' "$queue" | |
else | |
# Make sure the list is non empty | |
if [ ! -s "$static" ]; then | |
echo "$0: error: empty slideshow list" > /dev/stderr | |
exit 1 | |
fi | |
# find the next item in the list | |
uri=$(cat "$static" "$static" | grep -m 1 -e "^$uri$" -A1 | tail -1) | |
if [ -z "$uri" ]; then | |
uri=$(head -1 "$static") | |
fi | |
fi | |
echo "$uri" | |
} | |
while true; | |
do | |
nextUri | |
echo uri $uri > $UZBL_FIFO | |
sleep $Zzz; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment