]> git.wh0rd.org - home.git/blame - .bin/randomwallpaper
cros-board: update
[home.git] / .bin / randomwallpaper
CommitLineData
5b61754d
MF
1#!/bin/bash
2
3[[ ${SVCNAME} == "dcron" ]] && exec >& /dev/null
4
5[ -e ~/.nowallpaper ] && exit 0
6#[ -z "`pgrep X-life-line`" ] && exit 0
7
8WALLPAPEROPTS="-s"
9WALLPAPERPROG="Esetroot"
10
11WALLPAPERDIRS="
12/usr/share/pixmaps/wallpapers/active
13"
14
15WALLPAPERCOUNT=0
16for dir in ${WALLPAPERDIRS} ; do
17 tmpcnt=`ls ${dir} | wc -l`
18 WALLPAPERCOUNT=$((${WALLPAPERCOUNT} + ${tmpcnt}))
19done
20[ ${WALLPAPERCOUNT} -eq 0 ] && exit 0
21WP=`expr ${RANDOM} % ${WALLPAPERCOUNT} + 1`
22
23[ -z "$1" ] \
24 && WALLPAPER="`find ${WALLPAPERDIRS} -maxdepth 1 -type f -o -type l | cut -d$'\n' -f ${WP}`" \
25 || WALLPAPER="$1"
26
27${WALLPAPERPROG} ${WALLPAPEROPTS} "${WALLPAPER}"
28