LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   desktop image rotator (https://www.linuxquestions.org/questions/linux-software-2/desktop-image-rotator-640112/)

PMorph 05-05-2008 02:43 PM

desktop image rotator
 
My favorite desktop image switching utility chbg seems to have problems in Debian Lenny, so looking for a replacement.

The requirements are simple:
-rotate through images in a specified folder or list (either is ok)
-configurable image change interval
-continue from previous image on startup (or next image)
-with a gui or not, does not matter (but simple is better)

Tried to look for one with these requirements, found none.. :confused:
Any ideas?

Zaskar 05-06-2008 09:41 AM

Check out the program called "feh"
You should be able to get it with apt

PMorph 05-06-2008 03:58 PM

Thanks for the tip Zaskar :)
I played with feh for a while and it is a nice tool, but I still couldn't get the looping quite the way I want it.

So I thougt I'll use "hsetroot" and try to script the rest.. The result appears to work, but my bash scripting skill are very rudimentary, so I attached the "proto" below for anyone with better experience to comment.

Usage for setup: --setup <image folder path>
Usage for execute: <image switching delay in seconds>

Code:

#!/bin/bash

# If setup was requested, just build the image list and exit
if [ "$1" == "--setup" ]; then
  find "$2" | grep -i .jpg > .background_list
  exit
fi

# Make sure the image switching delay is not unreasonably small
delay=$1
if [ "1" -gt "$delay" ]; then
  delay=1
fi

# Get the number of images in the image list
img_no_max=`awk 'END {print NR}' .background_list`

# Set the next root window image, delay for a while, repeat..
while [ 1 ]; do
  # Get the order number of the next image in the image list
  img_no=`cat .background_no`
  # Get the image name, according to the order number
  img_name=`awk -v no=$img_no 'NR==no {print}' .background_list`
  # Display the image
  hsetroot -center $img_name

  # Increase the order number for the next image.
  # Reset the count if last image has been displayed
  img_no=$[$img_no+1]
  if [ "$img_no" -gt "$img_no_max" ]; then
      img_no=1
  fi
  echo > .background_no $img_no

  sleep $delay
done



All times are GMT -5. The time now is 01:44 AM.