Created
August 8, 2017 02:27
-
-
Save christopherobin/35f0ab264a16621a51eebf9fee22d81e to your computer and use it in GitHub Desktop.
Dual screen wallpapers with hourly random change (gnome/mate)
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/sh | |
# Drop all your images in a folder, let's call it /tmp/wallpapers then run this | |
# Take all your files from the output folder and put them somewhere in your | |
# home folder (like ~/Pictures/Wallpapers) | |
RES=$( xrandr | grep primary | awk '{ print $4 }' | cut -d '+' -f 1 ) | |
mkdir output 2>/dev/null | |
for a in *.{png,jpg,tga}; do | |
for b in *.{png,jpg,tga}; do | |
[[ "$a" != "$b" ]] && \ | |
[[ -f "$a" ]] && \ | |
[[ -f "$b" ]] && \ | |
echo "Merging $a and $b" && \ | |
convert \ | |
"$a" -resize "${RES}^" -gravity center -crop "${RES}+0+0" +repage \ | |
"$b" -resize "${RES}^" -gravity center -crop "${RES}+0+0" +repage \ | |
+append "output/${a}-${b}"; | |
# allows us to ctrl+c more easily | |
sleep 0.1; | |
done; | |
done; |
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/sh | |
# Change the variables up there and set this as a @hourly cronjob | |
UID=1000 | |
USER=crobin | |
DISPLAY=:0 | |
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${UID}/bus | |
GCONF=$( hash dconf && echo dconf || echo gconf ) | |
RANDOM_WALLPAPER=$( /usr/bin/ls -1 /home/${USER}/Pictures/Wallpapers/output | /usr/bin/sort -R | /usr/bin/head -1 ) | |
/usr/bin/${GCONF} write /org/mate/desktop/background/picture-filename \ | |
"'/home/crobin/Pictures/Wallpapers/result/${RANDOM_WALLPAPER}'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment