You are not logged in.
solution
#!/bin/sh
while true;
do
feh --bg-scale "$(find $HOME/.wallpaper -type f -name '*.jpg' -o -name '*.png' | shuf -n 1)"
sleep 15s
done &
I have the awesome configured to change to a random background each time I start but I thought it would be fun to have it change every minute.
I tried copying the command "awsetbg -r '~/images'" into the section where the clock is updated but it didn't work.
Does anyone know how to do this?
Last edited by atomicpookavirus (2009-07-15 03:49:11)
Offline
Cron job?
http://en.wikipedia.org/wiki/Cron
I'm sure someone will enlighten you more if you can't find enough material to help you on the web.
Offline
Something like the following added to your rc.lua should work. However, I have not tested it, so YMMV
Perhaps you already have a 60 sec timer, in which case you should just add the os.execute call to that function.
I would probably use a cron job too though...
-- -- {{{ 60 Sec Timer
awful.hooks.timer.register(60, function ()
os.execute("awsetbg -r '~/images'")
end)
-- -- }}}
.]
Offline
Thanks for all the replies!
This works but chokes on filenames with spaces.
#!/bin/sh
while true;
do
find $HOME/.wallpaper -type f -name '*.jpg' -o -name '*.png' | shuf -n 1 | xargs feh --bg-scale
sleep 15m
done &
Offline
feh --bg-scale "$(find $HOME/.wallpaper -type f -name '*.jpg' -o '*.png' | shuf -n 1)"
sleep 15m
this should fix your spaces issue. you can also use `| sort -R | head -n1`.
oh, and be careful about your LC_ALL environment variable (it should = C).
edit: had second thoughts, but i believe the above will work. (tested successfully with `ls | sort -R | head -n1`, can only imagine `find | shuf` will work too.)
Last edited by brisbin33 (2009-07-14 21:41:02)
//github/
Offline
Thanks for that, brisbin.
It works with a minor alteration:
#!/bin/sh
while true;
do
feh --bg-scale "$(find $HOME/.wallpaper -type f -name '*.jpg' -o -name '*.png' | shuf -n 1)"
sleep 15s
done &
(I added -name before '*.png'.)
This is excellent too cool.
I'm still learning shell scripting so appreciate the help.
Eventually I hope to have it set up with a key bind/menu to switch a particular wallpapers settings such as tiled, scale, etc...and have those settings stick for next time it appears.
Offline