Skip to content

Instantly share code, notes, and snippets.

@GuilhermeBarile
Created January 5, 2016 18:21
Show Gist options
  • Select an option

  • Save GuilhermeBarile/a3d91319e83c65624708 to your computer and use it in GitHub Desktop.

Select an option

Save GuilhermeBarile/a3d91319e83c65624708 to your computer and use it in GitHub Desktop.

Revisions

  1. Guilherme Barile created this gist Jan 5, 2016.
    51 changes: 51 additions & 0 deletions nautilus-psd-thumbnails.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@
    #!/bin/bash

    # -----------------------------------------------------------
    # -- Write psdthumbnailer
    # -----------------------------------------------------------
    OUTFILE=/usr/lib/psdthumbnailer
    (
    sudo cat <<'EOF'
    # bin/bash
    # Arguments / Parameters %i %o %s
    f_in=$1
    f_out=$2
    f_size=$3
    # Execute Convert PSD to PNG through ImageMagick
    exec convert "psd:$f_in[0]" -scale "$f_sizex$f_size" "png:$f_out"
    EOF
    ) > $OUTFILE
    # -----------------------------------------------------------
    # -- Write photoshop.thumbnailer
    # -----------------------------------------------------------
    OUTFILE=/usr/share/thumbnailers/photoshop.thumbnailer
    (
    sudo cat <<'EOF'
    # bin/bash
    [Thumbnailer Entry]
    TryExec=/usr/lib/psdthumbnailer
    Exec=/usr/lib/psdthumbnailer %i %o %s
    MimeType=image/vnd.adobe.photoshop; image/x-photoshop; image/x-psd;
    EOF
    ) > $OUTFILE
    # -----------------------------------------------------------
    # -- Set File Permissions
    # -----------------------------------------------------------
    sudo chmod 0755 /usr/lib/psdthumbnailer
    sudo chmod 0644 /usr/share/thumbnailers/photoshop.thumbnailer

    # -----------------------------------------------------------
    # -- Add GConf Hooks to parse thumbnails
    # -----------------------------------------------------------
    sudo gconftool-2 --set /desktop/gnome/thumbnailers/[email protected]/enable --type bool true

    sudo gconftool-2 --set /desktop/gnome/thumbnailers/[email protected]/command --type string "/usr/lib/psdthumbnailer %i %o %s %i %o %s"

    # -----------------------------------------------------------
    # -- Install Dependencies
    # -----------------------------------------------------------

    sudo apt-get install imagemagick