LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   rotating background image script (https://www.linuxquestions.org/questions/slackware-14/rotating-background-image-script-916474/)

michijo 11-30-2011 08:13 PM

rotating background image script
 
has this been covered anywhere: rotating background image script? I want to rotate Pieter Bruegel the Elder paintings of peasants! But I use Xmonad as my window manager. Interested in script that doesn't need Gconf.

I am going to try to write one. I have: a command is repeated on a timer, such as here:

http://www.unix.com/shell-programmin...t-command.html

The command is a command to select a wallpaper.

wmsetbg -t ~/backgrounds/massacre.jpg

"wmsetbg" does not have an option to select a random wallpaper. Does anyone know a way to get a random wallpaper set?

Thanks!

T3slider 11-30-2011 08:19 PM

If you have fluxbox installed you can use fbsetbg, which has the -r option for setting a random wallpaper from a specified directory.

michijo 11-30-2011 10:05 PM

it worked!
 
Okay thanks for that tip. It works now and is switching well!

Code:

#!/bin/bash

while :
 
 do

  fbsetbg -t -r /home/michijo/backgrounds

  sleep 30

 done


D1ver 12-01-2011 05:58 AM

I use the following to randomly set backgrounds on log in, or added to crontab to run every 2 hours
Code:

#!/bin/bash
export DISPLAY=:0.0
WALLPAPERS="/home/neil/Pictures/wallpapers/"
ALIST=( `ls -w1 /home/neil/Pictures/wallpapers` )
RANGE=${#ALIST[@]}
let "number = $RANDOM"
let LASTNUM="`cat $WALLPAPERS/.last` + $number"
let "number = $LASTNUM % $RANGE"
echo $number > $WALLPAPERS/.last

feh --bg-scale $WALLPAPERS/${ALIST[$number]}

Pinched the script from the Debian openbox wiki

michijo 12-01-2011 11:46 PM

scripts
 
The script I made does just the thing though: it rotates slowly through Bruegel paintings. This is a fantastic way to view artwork on the sly, by presaving paintings I like then adding them to the gallery. Already since doing this, I have been analyzing Bruegel paintings and noticing little minute details I never noticed before.


All times are GMT -5. The time now is 06:12 PM.