From ec485688cd407bb0983c208dbf2c3267a9a071fc Mon Sep 17 00:00:00 2001 From: j-james Date: Wed, 21 Oct 2020 14:30:57 -0700 Subject: Create custom folder thumbnailer for Tumbler --- .SRCINFO | 17 +++++++++++++++++ LICENSE | 5 +++++ PKGBUILD | 18 ++++++++++++++++++ folder-thumbnailer | 15 +++++++++++++++ folder.thumbnailer | 7 +++++++ 5 files changed, 62 insertions(+) create mode 100644 .SRCINFO create mode 100644 LICENSE create mode 100644 PKGBUILD create mode 100644 folder-thumbnailer create mode 100644 folder.thumbnailer diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..b2bb258 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,17 @@ +pkgbase = tumbler-folder-thumbnailer + pkgdesc = Custom folder thumbnails for Tumbler + pkgver = 1 + pkgrel = 1 + url = https://docs.xfce.org/xfce/tumbler/available_plugins + arch = any + license = BSD + depends = tumbler + depends = imagemagick + optdepends = inkscape: for SVG support + source = folder.thumbnailer + source = folder-thumbnailer + sha512sums = e62c5407390861affdcaf5029f2d7c28d1e623d6361d37a28af0e36cd2dec5c3226d747c608b8b88c5e4deb00197d0d35656963ade5e3a160b0cc29bfcf31bac + sha512sums = e6b5ab3e805dbb187ca1dce12ef18c11595628ecdde68c2b1ded8c19a7c03a828e96b7cebc0af5bddfbdd0587fbad5e91974c2575a7ca764e38ef9b1c717d1e5 + +pkgname = tumbler-folder-thumbnailer + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d673196 --- /dev/null +++ b/LICENSE @@ -0,0 +1,5 @@ +Copyright (C) 2020 by j-james + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..89e8fe1 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,18 @@ +pkgname=tumbler-folder-thumbnailer +pkgver=1 +pkgrel=1 +pkgdesc="Custom folder thumbnails for Tumbler" +arch=('any') +url="https://docs.xfce.org/xfce/tumbler/available_plugins" +license=('BSD') +depends=('tumbler' 'imagemagick') +optdepends=('inkscape: for SVG support') +source=('folder.thumbnailer' + 'folder-thumbnailer') +sha512sums=('e62c5407390861affdcaf5029f2d7c28d1e623d6361d37a28af0e36cd2dec5c3226d747c608b8b88c5e4deb00197d0d35656963ade5e3a160b0cc29bfcf31bac' + 'e6b5ab3e805dbb187ca1dce12ef18c11595628ecdde68c2b1ded8c19a7c03a828e96b7cebc0af5bddfbdd0587fbad5e91974c2575a7ca764e38ef9b1c717d1e5') + +package() { + install -Dvm644 "folder.thumbnailer" "$pkgdir/usr/share/thumbnailers/folder.thumbnailer" + install -Dvm755 "folder-thumbnailer" "$pkgdir/usr/bin/folder-thumbnailer" +} diff --git a/folder-thumbnailer b/folder-thumbnailer new file mode 100644 index 0000000..b4b0b5b --- /dev/null +++ b/folder-thumbnailer @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -f "$2/.folder.jpg" ]; then + convert -thumbnail "$1" "$2/.folder.jpg" "$3" 1>/dev/null 2>&1 +elif [ -f "$2/.folder.png" ]; then + convert -thumbnail "$1" "$2/.folder.png" "$3" 1>/dev/null 2>&1 +elif [ -f "$2/.folder.svg" ]; then + inkscape --export-type=png --export-dpi=500 "$2/.folder.svg" --export-filename="$3" 1>/dev/null 2>&1 + convert -thumbnail "$1" "$3" "$3" 1>/dev/null 2>&1 +else + rm -f "$HOME/.cache/thumbnails/normal/$(echo -n "$4" | md5sum | cut -d " " -f1).png" || \ + rm -f "$HOME/.thumbnails/normal/$(echo -n "$4" | md5sum | cut -d " " -f1).png" || \ + rm -f "$HOME/.cache/thumbnails/large/$(echo -n "$4" | md5sum | cut -d " " -f1).png" || \ + rm -f "$HOME/.thumbnails/large/$(echo -n "$4" | md5sum | cut -d " " -f1).png" +fi diff --git a/folder.thumbnailer b/folder.thumbnailer new file mode 100644 index 0000000..2122e91 --- /dev/null +++ b/folder.thumbnailer @@ -0,0 +1,7 @@ +[Thumbnailer Entry] +Version=1.0 +Encoding=UTF-8 +Type=X-Thumbnailer +Name=Folder Thumbnailer +MimeType=inode/directory; +Exec=/usr/bin/folder-thumbnailer %s %i %o %u -- cgit v1.2.3-70-g09d2