Created
March 29, 2016 22:41
-
-
Save stuartlangridge/c4929b89f9867ed7f3012e55c6b19c6c to your computer and use it in GitHub Desktop.
Simple Nautilus wallpaperify script, as per https://plus.google.com/u/0/+joeysneddon/posts/a3i2L9dyESp. (Save as $HOME/.local/share/nautilus/scripts/Wallpaperify.)
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
#!/bin/bash | |
file --brief --mime-type "$1" | grep "^image/" | |
if [ $? != 0 ]; then | |
zenity --error --text="'$1' does not seem to be an image file." | |
exit 1 | |
fi | |
if ! hash convert 2>/dev/null; then | |
zenity --error --text="You do not have ImageMagick installed, sorry." | |
exit 2 | |
fi | |
OUT=${1%.*}-wp.jpg | |
convert \( "$1" -resize 1920x1080^ -gravity center -extent 1920x1080 -blur 0x12 \) \( "$1" -resize 1920x1080 -gravity center \) -composite "$OUT" | |
OUTFULL=$(readlink -m "$OUT") | |
FURI=$(echo "$OUTFULL" | perl -MURI::file -e 'print URI::file->new(<STDIN>)."\n"') | |
gsettings set org.gnome.desktop.background picture-uri "$FURI" | |
zenity --info --text="Background set." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install with this command, all on one line:
mkdir -p ~/.local/share/nautilus/scripts && wget -O ~/.local/share/nautilus/scripts/Wallpaperify https://gist.githubusercontent.com/stuartlangridge/c4929b89f9867ed7f3012e55c6b19c6c/raw/6fe3ae817396ffabf20ba5b1dd1c4c58a67f4947/Wallpaperify && chmod +x ~/.local/share/nautilus/scripts/Wallpaperify && nautilus ~/.local/share/nautilus/scripts/ && zenity --info --text="You may need to refresh this Nautilus window so that Wallpaperify shows up"