Post Your Thunar Custom Actions Here

Here you can discuss every aspect of Debian. Note: not for support requests!

Re: Rename your .jpg images to EXIF date

Postby dbbolton » 2010-12-07 06:44

mzilikazi wrote:This is a quick way to rename alot of images to something more useful than DSCF3727.JPG
Code: Select all
apt-get install jhead


New Action>
Name: Rename To EXIF Date
Description: Rename image file to EXIF date/time
Command: /path/to/RenameToExifDate %f

Code: Select all
#!/bin/bash
while [[ -n "$1" ]]; do
   #if a file and not a dir
   if [[ -f "$1" ]]; then
      jhead -nf%m.%d.%Y_%H:%M "$1"
      fi
   shift
done

for i in *.JPG;
do mv $i `basename $i JPG`jpg;
done


It looks to me like the top part acts on a single file (since %f is the first selected file), while the bottom is acting on every file in the current directory. It seems like these tasks would better be separated-- for example, just make the action fix the file extension of the selected file, or perhaps have a separate action for fixing all file extensions in the directory, so that the operation isn't needlessly carried out repeatedly.

You could use a rename expression such as
Code: Select all
rename 'if ($_=~/^(.*\.)([A-Z]+)$/) { $_=$2; tr/[A-Z]/[a-z]/; $_=$1.$_}' *
to do the latter.
GitHub | zsh docs in Letter PDF

Telemachus wrote:Put down the CGI.
User avatar
dbbolton
 
Posts: 2133
Joined: 2007-06-20 08:17
Location: Iapetus

Re: Rename your .jpg images to EXIF date

Postby mzilikazi » 2010-12-07 16:36

dbbolton wrote:It looks to me like the top part acts on a single file (since %f is the first selected file),

Opps you're right - changed it to %F
It seems like these tasks would better be separated-.

My camera always names everything with the .JPG extension so these tasks are actually quite perfect together.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G
User avatar
mzilikazi
Forum Ninja
 
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Re: Rename your .jpg images to EXIF date

Postby dbbolton » 2010-12-07 21:34

mzilikazi wrote:My camera always names everything with the .JPG extension so these tasks are actually quite perfect together.

It makes more sense using %F, but I think you could even put your file test and subsequent actions inside the for loop. It would probably save you a millisecond if you were dealing with hundreds of files. Maybe another approach would be to use %d, and change the glob to $1/*, so you wouldn't have to select a bunch of files at once.

This is one feature that I have found to be problematic in Thunar: the padding (i.e., the space in which you can click to bring up the selection rectangle) between icons is quite small, especially vertically. I often end up seeing a floating icon under the pointer instead of the selection rectangle.
GitHub | zsh docs in Letter PDF

Telemachus wrote:Put down the CGI.
User avatar
dbbolton
 
Posts: 2133
Joined: 2007-06-20 08:17
Location: Iapetus

Re: Post Your Thunar Custom Actions Here

Postby julian67 » 2010-12-08 19:39

How about:
Code: Select all
#!/bin/bash
#rename2exif.sh
for PIC in "$@" ; do
extn=${PIC##*.}
exval=$(exiftime "$PIC" |grep Created|awk '{print $3"_"$4}')
mv "$PIC" "${exval:?NO EXIF DATA FOUND IN "$PIC"}".$extn
done


No need to test the file because if no exif data is found the process quits with the NO EXIF DATA... message.

Appearance conditions:

*.JPG;*.jpg;*.JPEG;*.jpeg

Thunar Command
Code: Select all
xfce4-terminal -H -x rename2exif.sh %F


Gives a file name like 2010:10:16_03:24:48.JPG

Original extension is always retained so JPG is JPG, jpeg is jpeg etc.

Requires: exiftags (in Debian main).
Wisdom from my inbox: "do not mock at your pottenocy"
User avatar
julian67
 
Posts: 4648
Joined: 2007-04-06 14:39
Location: Just hanging around

Copy /path/to/file & Copy file contents

Postby mzilikazi » 2010-12-09 18:51

Found this somewhere in the Xfce docs:
Copy /path/to/file to clipboard:
Code: Select all
echo -n %f|/usr/bin/xclip -selection c

Appearance conditions:
*
ALL


Copy file contents to clipboard
Code: Select all
xclip -in -selection c < %f

Appearance conditions
*.txt;*.TXT
Text Files
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G
User avatar
mzilikazi
Forum Ninja
 
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Re: Post Your Thunar Custom Actions Here

Postby dbbolton » 2010-12-09 19:56

julian67 wrote:How about:
Code: Select all
#!/bin/bash
#rename2exif.sh
for PIC in "$@" ; do
extn=${PIC##*.}
exval=$(exiftime "$PIC" |grep Created|awk '{print $3"_"$4}')
mv "$PIC" "${exval:?NO EXIF DATA FOUND IN "$PIC"}".$extn
done


No need to test the file because if no exif data is found the process quits with the NO EXIF DATA... message.

Appearance conditions:

*.JPG;*.jpg;*.JPEG;*.jpeg

Thunar Command
Code: Select all
xfce4-terminal -H -x rename2exif.sh %F


Gives a file name like 2010:10:16_03:24:48.JPG

Original extension is always retained so JPG is JPG, jpeg is jpeg etc.

Requires: exiftags (in Debian main).


I would probably pipe it to sed 's/[:]/-/g' because I'm really not a fan of colons in filenames. Duodena, however, are fine.
GitHub | zsh docs in Letter PDF

Telemachus wrote:Put down the CGI.
User avatar
dbbolton
 
Posts: 2133
Joined: 2007-06-20 08:17
Location: Iapetus

Re: Post Your Thunar Custom Actions Here

Postby canci » 2011-02-02 18:53

I played a bit with bash and made an Image Resizer which uses Zenity and Imagemagick. More here.

Image

To use it as a custom action, call it with the %N flag, NOT %F!. Like this:

Code: Select all
resize_img.sh %N


File Pattern: *
Selected file types: Image Files
I ken hez kinvulf beck? I ken hez riesnible modereyshn? Kthnxbai!

No need to discuss this topic? Offended by this signature? Remove it:

Mez wrote:You can easily just disable viewing signatures

Click here - and set "Display Signatures" to No
User avatar
canci
 
Posts: 1705
Joined: 2006-09-24 11:28
Location: Bosnia & Herzegovina

Re: Post Your Thunar Custom Actions Here

Postby traveler » 2011-04-04 17:49

This thread needs a bump. Here's a simple action to upload a text file to pastebin and give you the link in xterm.
Don't forget, xterm uses middle-button to copy/paste. Use middle-button to paste the link into your irc session or browser window, also.
Requires pastebinit:
Code: Select all
aptitude install pastebinit

Here's the action command:
Code: Select all
xterm -hold -e pastebinit %n

Select "text files" in "Appearance Conditions" tab.
I wish for a conjugal visit and world peace. (Don't want to seem selfish.)
User avatar
traveler
 
Posts: 942
Joined: 2010-06-09 22:07

Nitrogen Set As Wallpaper

Postby llua » 2012-06-18 19:18

Custom Action: Nitrogen Set As Wallpaper
Code: Select all
x=%f; sed -i "/^file/c\file=$x" ~/.config/nitrogen/bg-saved.cfg; nitrogen --restore


Appearance Conditions:
*
Image Files

Intended for a single monitor setup.
User avatar
llua
 
Posts: 3
Joined: 2010-04-03 15:52

Re: Post Your Thunar Custom Actions Here

Postby sjukfan » 2013-01-21 06:25

3/4 down this page there's a bunch of custum actions for thunar https://sites.google.com/site/debianins ... orial/xfce
I think this was quite clever
sync files/dirs to rsync -a %F `zenity --file-selection --directory`


Also here's a thread with a bunch of custom actions http://salinelinux.proboards.com/index. ... &thread=98
Bullseye amd64, AMD Ryzen 5 3600
Buster amd64, Intel Xeon E3-1240 v3
Sid ppc, PowerPC 7447a
Sid ppc64, PowerPC 970FX
User avatar
sjukfan
 
Posts: 386
Joined: 2010-03-01 19:39

Re: Post Your Thunar Custom Actions Here

Postby nemoinis » 2014-06-16 08:31

I wrote this "Show Original" custom action to launch another thunar window and highlight (select) the file or folder that a soft link points to.
The steps are:

  1. install "xdotool" if you don't have it installed already
  2. create a "Show Original" thunar custom action:
    appearance conditions: file pattern *, appears for "Directories" and "Other Files"
    command: showoriginal %f
  3. install this showoriginal script somewhere in your path:
Code: Select all
#!/bin/sh
#usage: showoriginal soft_link
#description: launch thunar to highlight the file or folder the soft_link argument points to
#requires xdotool

target=$(readlink -f "$@")
if [ -e "$target" ] ; then
    thedir=$(dirname "$target")
    thefile=$(basename "$target")
    nohup thunar "$thedir" >/dev/null
    sleep 0.5
    xdotool - <<EOF
key ctrl+f
type "$thefile"
EOF
xdotool key Escape
fi
nemoinis
 
Posts: 2
Joined: 2013-09-26 23:40

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable