Skip to content

Instantly share code, notes, and snippets.

@naranyala
Created September 8, 2023 07:17
Show Gist options
  • Save naranyala/564edd697a12a4363d61474e4501f9cf to your computer and use it in GitHub Desktop.
Save naranyala/564edd697a12a4363d61474e4501f9cf to your computer and use it in GitHub Desktop.
#!/bin/bash
# Function to change wallpaper
change_wallpaper() {
feh --bg-fill "$1" # This sets the wallpaper using Awesome's command
}
# Select random wallpaper from local collection
local_wallpapers_dir="/home/naranyala/repos/wallpapers/"
# List all image files in the local_wallpapers_dir
local_wallpapers=("$local_wallpapers_dir"/*.{jpg,jpeg,png,webp})
# Choose a random image from the list
random_index=$((RANDOM % ${#local_wallpapers[@]}))
random_wallpaper=${local_wallpapers[random_index]}
change_wallpaper "file://$random_wallpaper"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment