Skip to content

Instantly share code, notes, and snippets.

@stuartlangridge
Created March 29, 2016 22:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartlangridge/c4929b89f9867ed7f3012e55c6b19c6c to your computer and use it in GitHub Desktop.
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.)
#!/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."
@stuartlangridge
Copy link
Author

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment