Created
August 17, 2013 20:47
-
-
Save ronjouch/6258621 to your computer and use it in GitHub Desktop.
PNGQuanter, Nautilus script that calls PNGQuant from Nautilus's 'script' menu
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/bash | |
# AUTHOR: Ronan Jouchet <ronan@jouchet.fr>, based on another author-less Nautilus script | |
# VERSION: 1.0 | |
# LICENSE: MIT | |
# REQUIRES: - | |
# NAME: PNGQuanter | |
# DESCRIPTION: Reduce size with a call to pngquant | |
# INSTALL: Put script in ~/.local/share/nautilus/scripts and ensure it's executable | |
# Check that the user didn't select directories | |
for File in "$@" | |
do | |
if [ -d "$File" ]; then | |
zenity --error --text="'$File' is a directory. | |
PNGQuanter cannot handle directories." | |
exit | |
fi | |
done | |
# Use trash-put (provided by trash-cli) if present, else just rm | |
if which trash-put >/dev/null; then | |
pngquant "$@" && trash-put "$@" | |
else | |
pngquant "$@" && rm "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment