mirror of
https://git.sr.ht/~coasteen/dotfiles
synced 2025-11-04 14:47:38 +01:00
20 lines
527 B
Python
Executable file
20 lines
527 B
Python
Executable file
#!/usr/bin/env python3
|
|
import os
|
|
import secrets
|
|
import subprocess
|
|
|
|
BASE_DIR = "/home/coast/.local/src/wall"
|
|
|
|
wallpapers = []
|
|
for root, dirs, files in os.walk(BASE_DIR):
|
|
for file in files:
|
|
if file.lower().endswith(('.png', '.jpg', '.jpeg', '.bmp', '.gif')):
|
|
wallpapers.append(os.path.join(root, file))
|
|
|
|
if not wallpapers:
|
|
print("No wallpapers found!")
|
|
exit(1)
|
|
|
|
chosen_wallpaper = secrets.choice(wallpapers)
|
|
print(chosen_wallpaper)
|
|
subprocess.run(["swaybg", "-i", chosen_wallpaper, "-m", "fill"])
|