Created
January 7, 2023 23:15
-
-
Save erfanium/3b5957cfdc867d8ac475efeea6f1f684 to your computer and use it in GitHub Desktop.
randomly change ubuntu background
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate the query string by concatenating the arguments with commas | |
QUERY=$(printf ',%s' "$@") | |
QUERY=${QUERY:1} # remove leading comma | |
# Use xrandr to get the screen resolution | |
SCREEN_RES=$(xrandr --current | grep '*' | uniq | awk '{print $1}') | |
# Download the wallpaper and set it as the background | |
wget -O /tmp/wallpaper.jpg "https://source.unsplash.com/$SCREEN_RES/?$QUERY" | |
gsettings set org.gnome.desktop.background picture-uri file:///tmp/wallpaper.jpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment