Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random Wallpaper
#1
I use a very small bash snippet on my system which will automatically apply
a random wallpaper from my wallpaper directory every login.

The program applying the wallpaper in my case is 'feh'.

Code:
feh --bg-fill "$( find ~/Pictures/Wallpaper | shuf | head -1 )"

'find' will return filepaths to all images inside '~/Pictures/Wallpaper'.
'shuf' will randomise this list and 'head -1' will cut out all but the first one.
In combination, these three command give me the file path to a random picture
from my wallpaper directory, which is then used as wallpaper via 'feh'.

To change the wallpaper on every login, this bash snippet must put into the autostart
mechanism of your DE or WM (I placed it in '~/.xinitrc').


Although technically not really useful, I love this, as I get bored of a wallpaper quite fast.
My website - My git repos

"Things are only impossible until they’re not." - Captain Jean-Luc Picard
Reply
#2
leon.p
Nice little bash - short and simple keeping with our philosophy of 'do one thing and do it well'
I've always preferred simple little scripts

I used to use something similar to this (on Arch) and create my own images before I got lazy and found Variety lol
All Operating Systems suck... but some more than others
Reply
#3
Okay, let's complicate this a bit---for fun of course.

I run a virtual Arch machine with LXDE and four desktops. I had it set up with a different wallpaper for each desktop. (One of the neat things about LXDE.)

I have written the following line of code and put it in the ~/.xinitrc file above the "startlxde" command:

feh --randomize --bg-max ~/.photographs/* (This randomly selects a photograph from the ~/photographs directory and loads it as the wallpaper.)

I then went to "Preferences" and to "Default applications for LXSession" and clicked on "Autostart" and
un-checked "pcmanfm-desktop profile LXDE" in order to disable the LXDE wallpaper function.

Here is the complication I mentioned: How can I modify my code so that it loads a different wallpaper for each of the four desktops? As the above code works now, it loads the same wallpaper photograph in all four desktops.

Richard
Reply
#4
(08-05-2019, 10:11 PM)Richard Wrote: Here is the complication I mentioned: How can I modify my code so that it loads a different wallpaper for each of the four desktops? As the above code works now, it loads the same wallpaper photograph in all four desktops.

That will only be possible with the thing you disabled: pcmanfm's desktop window. The reason is based in the design of X: It actually does not have mulitple workspaces. The window manager simply maps and un-maps (displays and hides) windows as you change from one workspae to another. The background is not just the same image, but the exact same window (in X the background is a window called the root window which is the master and start of the windowing tree). pcmanfm allows you to have different wallpapers for different workspaces by displaying a window above the root window. Whenever pcmanfm detects that the workspace changed, it updates the image. 'feh' is a very simple program and therefore does not have this feature.
My website - My git repos

"Things are only impossible until they’re not." - Captain Jean-Luc Picard
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)