Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-11-13 20:08:25

rogue_ronin
Member
Registered: 2015-03-03
Posts: 24

tumbler - renew folder

Hi,

Sometimes while working on images, tumbler leaves previews/thumbnails in thunar in an unfinished state. (Usually a visible strip at the top of the image, but largely grayed out in the remainder of the image.)

I'm wondering if there is a CLI command that can tell tumbler to redo the current directory, or something suchlike. I'd like to make a custom Thunar action.

The tumbler docs are kind of vague on the subject, at least to my non-programmer mind.

Aloha

Offline

#2 2022-11-13 20:26:00

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: tumbler - renew folder

Here is a Proof-of-Concept thunar custom action script that can be used to regenerate a thumbnail (make sure you test the script on dummy data first):

#!/bin/bash

# thunar custom action
# command = /path/to/script %F
# appearance = select all

delete_thumbnail () {
    hash=$(echo -n "file://$1" | md5sum | awk '{print $1}')
    rm -f ~/.cache/thumbnails/{normal,large}/$hash.png
}

for i in $1
do   

    if [[ -d "$i" ]]   # if its a directory
    then   # process all files
        for f in "$i"/*
        do
            delete_thumbnail "$f"
        done
    else   #its a file so just process it
        delete_thumbnail "$i"
    fi
    
done

exit 0

Create a custom action, command is script plus %F (/path/to/script %F), and on the Appearance tab, check all boxes.

In thunar, you can select any combination of files and/or directories and it will run.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2022-11-14 18:40:44

Tamaranch
Member
Registered: 2020-12-31
Posts: 321

Re: tumbler - renew folder

Some notes:

  • The problem described in the OP corresponds to https://gitlab.xfce.org/xfce/tumbler/-/issues/15 and should be fixed since Tumbler 4.17.0 in many cases (it depends on the file system, but typically it's ok on ext4).

  • The thumbnail URI must be correctly escaped to match the RFC 3986 standard required by the spec, so personally I use this:

    hash=$(printf '%s' "$(gio info "$1" | sed -n 's/^uri.* //p')" | md5sum - | cut -d' ' -f1)
  • Instead of hash=... ; rm ... you can also use

    gdbus call --session --dest=org.freedesktop.thumbnails.Cache1 --object-path /org/freedesktop/thumbnails/Cache1 --method org.freedesktop.thumbnails.Cache1.Delete "['$(gio info "$1" | sed -n 's/^uri.* //p')']"

    which should take care of everything.

Last edited by Tamaranch (2022-12-03 14:46:19)

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.021 seconds, 7 queries executed - Memory usage: 536.6 KiB (Peak: 544.37 KiB) ]