Created
September 26, 2024 06:26
-
-
Save fikr4n/132a17c26220a7ab884c8201b6852efa to your computer and use it in GitHub Desktop.
GNOME dynamic (slideshow) desktop background (XML) generator
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
#!/bin/zsh | |
# Place this file as the sibling of directory 'img/' which contains all the images. | |
# The output will be 'img.xml' which changes the backgrounds every 24 hours (86400 secs). | |
cd "${0:h}" | |
( | |
cat <<EOF | |
<background> | |
<starttime> | |
<year>2024</year> | |
<month>01</month> | |
<day>01</day> | |
<hour>00</hour> | |
<minute>00</minute> | |
<second>00</second> | |
</starttime> | |
EOF | |
shuf -e "$PWD"/img/* | while read -r i; do | |
echo Found: $i >&2 | |
cat <<EOF | |
<static> | |
<duration>86400.0</duration> | |
<file>$i</file> | |
</static> | |
EOF | |
done | |
cat <<EOF | |
</background> | |
EOF | |
) > img.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment