Hi. I'm Kingoverlord(nickname) from Kenya. Zorin 16 Core was my first ever distro to install bare metal. Well we all know gnome dosent have an inbuilt wallpaper changer like xfce right? So i installed variety and it worked well no fuss, untill zorin 17, with gnome 43.9. You guessed the issue, it wouldnt change backgrounds in dark mode. I found the fix in an ubuntu forum which fixed the issue no problem but a cost of random log outs and completely changing my zorin appearance settings. I fixed this though crossing fingers and hoping for the best... after a fresh zorin install. It showed the same error again only once and just decided to behave normally(but i messed my system when i was downloading ubuntu studio as an extension and reinstalled zorin again).
With that in mind i was pretty scared to install variety again so i turned to chat gpt to make a wallpaper changing script. It did, and a pretty good job. But it works the same, only in light mode.
I tried other wallpaper changers before the second installation of zorin and they too worked only in light mode. Well the reason they all do this is because of gnome. Try this command in terminal (for gnome desktop users) "gsettings set org.gnome.desktop.background picture-uri file:///path/to/your/image.jpg" change /path/to/your/image.jpg(or whatever file format your image is) to a valid path to an existing image in your directory. you can change this by changing your wallpaper in the settings later
This is a command to change your wallpaper, and it will only work in light mode, dark mode wont do anything. Its because of "picture-uri" in the command. If you change it to "picture-uri-dark" it works. This issue came with gnome 42 to present 43 and now these wallpaper changers have to specify the theme in order to change wallpapers ie picture-uri for light mode or picture-uri-dark for all the creatures of the dark.
Well, i have no coding experience to make my script run i dark mode and my trustee AI told me to look for help, hehe
Here's my code
#!/usr/bin/env python3
import os
import random
import subprocess
import time
# Directories containing your wallpapers
wallpaper_dirs = [
"/home/king-manarae/Pictures/Anime",
"/home/king-manarae/Pictures/Animegirl"
]
def get_wallpapers(directories):
"""Function to get a list of all image files in the directories."""
supported_extensions = ('.jpg', '.jpeg', '.png', '.bmp', '.gif')
wallpapers = []
for directory in directories:
if os.path.exists(directory):
for f in os.listdir(directory):
if f.lower().endswith(supported_extensions):
wallpapers.append(os.path.join(directory, f))
return wallpapers
def set_wallpaper(image_path, mode="zoom"):
"""Function to set the wallpaper using gsettings."""
try:
# Check current GNOME theme variant
theme_variant = subprocess.check_output(["gsettings", "get", "org.gnome.desktop.interface", "gtk-theme"]).decode().strip()
# Determine which gsettings key to use based on theme variant
if "dark" in theme_variant:
# For dark mode
subprocess.run(["gsettings", "set", "org.gnome.desktop.background", "picture-options", "zoom"], check=True)
subprocess.run(["gsettings", "set", "org.gnome.desktop.background", "picture-uri-dark", f"file://{image_path}"], check=True)
else:
# For light mode
subprocess.run(["gsettings", "set", "org.gnome.desktop.background", "picture-options", mode], check=True)
subprocess.run(["gsettings", "set", "org.gnome.desktop.background", "picture-uri", f"file://{image_path}"], check=True)
print(f"Wallpaper set successfully for {theme_variant} mode.")
except subprocess.CalledProcessError as e:
print(f"Error setting wallpaper: {e}")
def change_wallpaper(wallpapers):
"""Function to change the wallpaper."""
wallpaper_path = random.choice(wallpapers)
set_wallpaper(wallpaper_path)
if __name__ == "__main__":
# Get list of wallpapers from the directories
wallpapers = get_wallpapers(wallpaper_dirs)
# Check if wallpapers list is not empty
if not wallpapers:
print("No wallpapers found in the specified directories.")
exit(1)
else:
print(f"Found {len(wallpapers)} wallpapers.")
# Loop to change wallpaper every minute
while True:
change_wallpaper(wallpapers)
# Change wallpaper every minute (60 seconds)
time.sleep(60)