Created
August 20, 2019 15:52
-
-
Save iRi-E/472815d461eb261468eb91da8e2945d9 to your computer and use it in GitHub Desktop.
Linuxデスクトップのファイルマネージャーで.blendファイルのサムネイルを表示させるように設定するスクリプト
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 | |
# run this script in a directory in which blender-thumbnailer.py exists. | |
# add command line option '-u' to unregister the thumbnailer. | |
BINDIR=/usr/local/bin | |
if [ -n "$XDG_DATA_HOME" ]; then | |
SHAREDIR="$XDG_DATA_HOME" | |
else | |
SHAREDIR="$HOME/.local/share" | |
fi | |
# unregister | |
if [ "$1" == "-u" ]; then | |
sudo rm -v $BINDIR/blender-thumbnailer.py | |
rm -v "$SHAREDIR/thumbnailers/blender.thumbnailer" | |
echo "Done." | |
exit 0 | |
elif [ -n "$1" ]; then | |
echo "error: unknown option '$1'" >&2 | |
exit 1 | |
fi | |
# install thumbnailer script | |
if [ ! -f blender-thumbnailer.py ]; then | |
echo "error: blender-thumbnailer.py file not found in current directory." >&2 | |
exit 1 | |
fi | |
sudo cp -v --preserve ./blender-thumbnailer.py $BINDIR/ | |
# register thumbnailer | |
echo "creating '$SHAREDIR/thumbnailers/blender.thumbnailer'" | |
cat <<EOF > "$SHAREDIR/thumbnailers/blender.thumbnailer" | |
[Thumbnailer Entry] | |
TryExec=$BINDIR/blender-thumbnailer.py | |
Exec=$BINDIR/blender-thumbnailer.py %u %o | |
MimeType=application/x-blender; | |
EOF | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment