Page 4 of 4

Re: Rename your .jpg images to EXIF date

Posted: 2010-12-07 06:44
by dbbolton
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.

Re: Rename your .jpg images to EXIF date

Posted: 2010-12-07 16:36
by mzilikazi
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.

Re: Rename your .jpg images to EXIF date

Posted: 2010-12-07 21:34
by dbbolton
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.

Re: Post Your Thunar Custom Actions Here

Posted: 2010-12-08 19:39
by julian67
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).

Copy /path/to/file & Copy file contents

Posted: 2010-12-09 18:51
by mzilikazi
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

Re: Post Your Thunar Custom Actions Here

Posted: 2010-12-09 19:56
by dbbolton
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.

Re: Post Your Thunar Custom Actions Here

Posted: 2011-02-02 18:53
by canci
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

Re: Post Your Thunar Custom Actions Here

Posted: 2011-04-04 17:49
by traveler
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.

Nitrogen Set As Wallpaper

Posted: 2012-06-18 19:18
by llua
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.

Re: Post Your Thunar Custom Actions Here

Posted: 2013-01-21 06:25
by sjukfan
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

Re: Post Your Thunar Custom Actions Here

Posted: 2014-06-16 08:31
by nemoinis
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