#!/bin/bash # # Author: Twily 2017 # Description: Wallpaper switcher ever X second. # Usage: $ nohup ./randwall > /dev/null 2>&1 & # (ps aux|grep randwall) # Requires: curl and python for remote wallpapers # Source: desktoppr: https://gist.github.com/zviryatko/055f8f4850bf17323c4f127a4daeccdf # lock() { exec 200>/var/lock/.randwall.exclusivelock flock -n 200 && return 0 || return 1 } lock || exit 1 DIR="/home/amalie/Pictures/WP" LST="/tmp/myimages.list" SEC=$(( 10 * 60 )) while :; do # Use local images #rm -f "$LST" #find $DIR -type f \( -iname \*.jpg -o -iname \*.jpeg -o -iname \*.png \) > "$LST" #PIC=$(shuf -n 1 "$LST") # Use remote images (requires curl, python, optional imagemagic) PIC="/tmp/wallpaper.jpg" curl -s `curl -s https://api.desktoppr.co/1/wallpapers/random | python -c "import json,sys; obj=json.load(sys.stdin); print obj['response']['image']['url'];"` > $PIC convert $PIC -blur 0x16 $PIC #pcmanfm --set-wallpaper "$PIC" feh "$PIC" --bg-fill sleep $SEC done exit