You are not logged in.
I wrote a simple script to change my IceWM background
#! /bin/bash
cd ~/Pictures `ls ~/Pictures | shuf` #Selects random folder from picture folder
cp `ls | shuf | head -1` ~/icewm.jpg #Selects random image and copies to icewm.jpg
#sleep 2 # I thought that if I let it slept for a bit it might have helped but it didn't
icewmbg -r #Resets Icewm Background Image
When I run this script from either the terminal or file manager it works fine. It copies the image to ~/icewm.jpg and sets it as the background.
When I use cron to run it it only copies the image to ~/icewm.jpg and doesn't "seem" to run icewmbg -r.
Any one have any ideas?? Thanks in advance!!
Last edited by pluckypigeon (2010-01-04 03:12:58)
Offline
cron doesn't know about your X session. Do something like
DISPLAY=:0 icewmbg -r
so it can find it.
Offline
cron doesn't know about your X session. Do something like
DISPLAY=:0 icewmbg -r
so it can find it.
Thanks for your reply, that work perfectly
I was tempted to throw in an xterm -e
Offline
I did use this script for some time adapted from some wiki article (I forgot which one, unfortunately). No need for cron then.
#!/bin/sh
#
# Randomly change the IceWM wallpaper every 30 minutes.
while true;
do
sleep 30m
WP=$(find $HOME/.wallpapers -type f -name '*.jpg' -o -name '*.png' | shuf -n 1)
ln -sf $WP ~/.icewm/IceWMBackgroundImage.img
icewmbg -r &>/dev/null
done
But, alas, I did switch to openbox since then (whith some similar script running, btw).
To know or not to know ...
... the questions remain forever.
Offline
Offline
But, alas, I did switch to openbox since then (whith some similar script running, btw).
feh?
In openbox? Sure!
#!/bin/bash
#
# Randomly display a wallpaper every 30 minutes.
while true;
do
find $HOME/.wallpapers -type f -name '*.jpg' -o -name '*.png' | shuf -n 1 | xargs feh --bg-scale
sleep 30m
done &
Icwmbg is more involved, however.
To know or not to know ...
... the questions remain forever.
Offline
ln -sf $WP ~/.icewm/IceWMBackgroundImage.img
Why the link to an img file??
Does this mean that the viewer has to work out whether it's a png or jpg??
Offline
bernarcher wrote:ln -sf $WP ~/.icewm/IceWMBackgroundImage.img
Why the link to an img file??
Does this mean that the viewer has to work out whether it's a png or jpg??
Sorry, I don't really remember why I did so. Could well have been caused by some tool I once experimented with.
You are free to use whatever fits. It needs only match the DesktopBackgroundImage setting in the ~/.icewm/preferences file, like e.g.:
# Desktop background image
DesktopBackgroundImage = "/home/bp/.icewm/IceWMBackgroundImage.img"
To know or not to know ...
... the questions remain forever.
Offline