Bing wallpaper on XFCE

On my virtual machine with Zorin lite 17 and Zorin core desktop I have installed the gnome extension bing wallpaper.
I'd like to set up my Zorin lite session this way, that the desktop background shows the bing wallpaper of the day. Is this possible without installing variety or another app/script?

I found this one

Is it save to use?
I'm not sure if I need it because I already get the wallpapers from the gnome extension and they are saved at ~/Bilder/BingWallpaper.

I'd like to set it so that the xfce background takes the latest file from this folder.

This script is safe to run but it will download new images, and if I understand correctly you only want to use the ones that you already have, correct?

Yes, exactly - if it is possible, as the gnome-extension downloads the pictures.
Or does the script recognize when the current image of the day is already available? I don't want to download it twice.

But I just remembered that I can also simply display a random image from the Bing wallpapers, which changes every day. That would be fine with me too. I think I would have to write a script for the current image and start it when I log in. That is difficult.

It looks like this script will handle everything from checking the new picture of the day, to download it at a specified location and then update the wallpaper. But if you are using another program that does the same, there might be a slight conflict there which is always preferable to avoid.

If you want I can write something for you, derived from this script you shared to just download the picture of the day and save it in your preferred location. Then you can choose to update the background or not however you wish.

Thank you very much for the kind offer, Zenzen! I really appreciate it.
I was more concerned with how to avoid double downloads. Since the script only controls the background image for the xfce4-desktop and the gnome extension only controls the background image for the gnome desktop, there should probably be no conflicts.

Ah, I see. And you said you only want to use the last file that was downloaded to your wallpapers directory?

You still need a script for that but should be fairly simple. The only challenge is: do you have one or more monitors? The way this script does it it by specifying the background image on each monitor, but knowing this upfront might make things simpler. Or in case you want to have it done separately.

I only have the notebook monitor. Yes, I'd like to have a script that sets the latest file of the folder bing wallpapers at
~/Bilder/BingWallpaper
as background at start and changes every day.

Try with this:

#!/bin/bash

WALLPAPER_DIR="$HOME/Bilder/BingWallpaper"

last_wallpaper=$(ls -t "$WALLPAPER_DIR" | head -n 1)

for mon in $(xrandr | awk '/\s+connected\s+/ { print $1 }'); do
    prop_name="/backdrop/screen0/monitor${mon}/workspace0/last-image"
    xfconf-query -c xfce4-desktop -p "$prop_name" -s "$WALLPAPER_DIR/${last_wallpaper}"
done

You'll have to make it executable with chmod u+x <name_of_script> first. Run it once to see if it works fine first, and if it does add it to the Application Startup by creating a desktop file for it.

Thank you very much! I'll try it tomorrow, I have no access to this notebook at the moment.

1 Like

Hello Zenzen, unfortunately, I haven't been able to get the script to run. Maybe it's because of an incorrect file name? I'm not sure what extension the file needs to have, whether it's .zsh or .sh or something else (I use ZSH as my default terminal).

I also tried variety, which I had already installed once before. That would also be an option, as I can use this app on both DEs, but I prefer the Gnome extension because it also offers the option of only keeping the current image of the day.

.sh is correct.

And make sure the script has executable permission.

2 Likes

The .zsh will refer only to Z-Shell specific files. It is near coincidental that they have similar file extensions.
Both use the word "Shell."

However, any shell script will be .sh

1 Like

Unfortunately, it's not working yet. Maybe I need to add a path to .zshrc or save the script at a special place? Now it is saved at ~/Schreibtisch (desktop).

Try replacing
for mon in $(xrandr | awk '/\s+connected\s+/ { print $1 }'); do

with
for mon in $(xrandr | awk '/ connected/ {print $1}'); do
which avoids the peri-style regex

2 Likes

That worked! Thank you very much!

1 Like

I remember reading somewhere that awk cannot read \

It doesn't work with autostart yet. Maybe I'm doing something wrong?
I entered the path to the script as the command in autostart. Is that wrong?
It opens randomly images of the BingWallpaper folder.

Edit: Added sleep 5 to autostart command and it works now. The command: sh -c "sleep 5; ~/Schreibtisch/BingHintergrundScript.sh"

Thank you all for helping me.

1 Like

Yeah, regular expression flavors are the bane of my existence. That's why I'm liking writing scripts in Perl more and more these days :smiley:

I guess that might be because it's running before network is available? In any case I've marked this as solved for now :+1:

1 Like