#!/bin/sh
# This script helps to set a random background from $DIR onto the root window
DIR="$HOME/picture/Fonds/"
RES=$(xwininfo -root|grep geometry|cut -d' ' -f4|cut -d+ -f1)
MAX=$(find $DIR -type f | wc -l)
NUM=$((RANDOM%MAX+1))
BACKGROUND=$(find $DIR -type f | head -n $NUM | tail -n 1)
TEST=$(identify "$BACKGROUND" | grep "$RES " | awk '{print $1}')
test ! -z "$TEST" && xsetbg "$BACKGROUND" || $0
You can modify it as you want, for instance comment RES to take all the backgrounds, even smaller or larger than your screen resolution, or set options to xsetbg like -fullscreen.
No comments:
Post a Comment