Last active
April 28, 2021 00:59
-
-
Save Limych/1ebb913ab57a87ce512bb72a5dca1807 to your computer and use it in GitHub Desktop.
Rotate best Earth photos as desktop background on Ubuntu
This file contains 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
#!/usr/bin/env bash | |
# Rotate best Earth photos as desktop background on Ubuntu. | |
# | |
# Just run this file via crontab. As example for every hour rotation: | |
# 0 * * * * ~/change_bg.sh | |
# | |
# Source: https://gist.github.com/Limych/1ebb913ab57a87ce512bb72a5dca1807 | |
user=$(whoami) | |
fl=$(find /proc -maxdepth 2 -user $user -name environ -print -quit) | |
while [ -z $(grep -z DBUS_SESSION_BUS_ADDRESS "$fl" | cut -d= -f2- | tr -d '\000' ) ] | |
do | |
fl=$(find /proc -maxdepth 2 -user $user -name environ -newer "$fl" -print -quit) | |
done | |
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS "$fl" | cut -d= -f2-) | |
wget -O - -q reddit.com/r/earthporn.json | jq '.data.children[] |.data.url' | grep -v 'reddit.com' | shuf -n 1 | xargs gsettings set org.gnome.desktop.background picture-uri |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment