Thursday, May 28, 2015

5.7 amd64 X200: Rotating random wallpaper using feh + cron. And more.

Hi,

Searching for rotating wallpaper on the web has given me a few good shell scripts to use. But what if I just want to use the good ol' crontab and feh? Here's what I've done.

What I'm on now:
- CWM
- feh

Obviously CWM is my WM of choice nowadays. And I've installed feh. My lappy's screen resolution is 1280x800 so I went searching for beautiful nature's wallpaper. Get more than 2 so I'll have many rotation choices.

For me, I mkdir a Wallpapers folder. So it's look like:

~/Wallpapers

I put all the pictures into that folder. Now for the cron part.

$ crontab -e

This is my first cron so the file is empty. I want this wallpaper to rotate using random picture every 5 minutes. So my cron is like this:

*/5 * * * * DISPLAY=:0.0 feh --bg-fill -z --no-fehbg ~/Wallpapers/

In short, human-readable meaning is every 5 minutes (*/5) the screen (DISPLAY=:0.0) will be used by feh to fill the picture as wallpaper (--bg-fill) randomly (-z) without writing a ~/.fehbg file (--no-fehbg) using pictures from the folder ~/Wallpapers .

Then press :WQ to write the changes and quit so the process will start. Enjoy the rotating wallpapers guys.

Ok. Now. What if I want to use random wallpapers everytime I log in to cwm? The command is the same like crontab there but I need to ready 2 things.

Editing ~/.xsession and put this line (before exec cwm or any WM of your choice).

eval `cat ~/.fehbg`
exec cwm

Now create/edit ~/.fehbg and put the command like in crontab (without the DISPLAY=:0.0 bit):

feh --bg-fill -z --no-fehbg ~/Wallpapers/

And it's done. Oh wait, how about another one? Get a menu to change to a random wallpaper in cwm. Open up ~/.cwmrc and put this:

command ChangeWP "feh --bg-fill -z --no-fehbg ~/Wallpapers/"

Then refresh the cwm (by default should be pressing Ctrl+Alt+Shift+R) and click the menu.

Man crontab / feh for more info. Later.

No comments:

6.5 amd64: Modify existing certbot certificates.

Hi, It's been quite some time eh. As you can see, I still upgrade my OpenBSD system regularly but currently I do not have the time to ...