Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Post Your Thunar Custom Actions Here
Re: Post Your Thunar Custom Actions Here
I think the better subject line for this thread would've been something like
Post Your Thunar Custom Actions Here (and even if you don't use Thunar, you'll find a lot of good scripts (or at least ideas for scripts) to fill your ~/bin with)
Post Your Thunar Custom Actions Here (and even if you don't use Thunar, you'll find a lot of good scripts (or at least ideas for scripts) to fill your ~/bin with)
Q: Why is the Eunux kernel so bloated?
A: It was made in the image of its founder.
A: It was made in the image of its founder.
- ComputerBob
- Posts: 1181
- Joined: 2007-11-30 04:49
- Location: The Mountains of the Sunshine State
- Been thanked: 1 time
Re: Post Your Thunar Custom Actions Here
@dbbolton - Thanks for explaining it!
ComputerBob - Making Geek-Speak Chic (TM)
ComputerBob.com - Nearly 6,000 Posts and 23 Million Views
My Massive Stroke
Help! (off-topic)
_________________
Your Life Matters
ComputerBob.com - Nearly 6,000 Posts and 23 Million Views
My Massive Stroke
Help! (off-topic)
_________________
Your Life Matters
Re: Post Your Thunar Custom Actions Here
Thunar's bulk rename is pretty handy, but it seems awkward when performing several operations on the same group of files. I use this script to get rid of "bad" characters in filenames: http://github.com/dbbolton/scripts/blob ... -rename.pl
According to lines 46 and 47,will be replaced with a '_' will be replaced with a '-', and the ampersand will be replaced with 'and'. If a file already exists, an integer will be stuck on the end until the name is unique. If a file extension is detected (id est a '.' followed by 1 or more word characters), the number is added before the '.'. This might seem a bit awkward too, because you will end up with 'file012' if 'file0' and 'file01' both happen to exist already. But if you have that many similarly named files in one place, you might have bigger fish to fry. I'm thinking about adding another block that will check for an integer at the end of the name and save it to a variable to be incremented rather than just catenating a new one to the end. But for now this thing does what I need it to do. Eventually Imperator Margaritae* aka Telemachus will show up and show me what I did wrong.
It operates on the first argument or, if none is given, the current directory
* - "Margarita" dixi quia verbum quod "Perl" significat in hac lingua non exsistit.
According to lines 46 and 47,
Code: Select all
!"#$%'*+,:;?@\
Code: Select all
()<=>[]^`{|}~
It operates on the first argument or, if none is given, the current directory
* - "Margarita" dixi quia verbum quod "Perl" significat in hac lingua non exsistit.
Re: Post Your Thunar Custom Actions Here
I've been using GVim as my editor in X lately (Kate's vi mode is pretty rudimentary)dbbolton wrote:To open a file in a new tab in Kate:Code: Select all
kate -u %f
Code: Select all
gvim --remote-tab %F
Re: Post Your Thunar Custom Actions Here
(Batch) Convert YouTube videos to .mp4
This is for the YouTube stuff that is in /tmp where the YT video cached (I never worked out the purpose of many of those clever conversion apps when all you have to do is copy the file somewhere else). As far as I can tell all non-DRM/obfuscated YT content is offered h.264+aac in flash, so no need for video or audio conversion, all that's required is to put it in an mp4 container and then it will play even in dumb media players which rely on file extensions to identify content type. You could just as easily use mkv (it saves a little space). No encoding, only muxing, so very quick.
custom action:
You can run it without launching xfce4-terminal so then only but the terminal is useful in case of errors, and personally I get huge thrills watching the ffmpeg output flash by.
Requires this script or similar to be in your path and executable.
You can easily change the ffmpeg options if you want to transcode to different video and audio codecs, for example to make an avi with mp2 audio and divx compatible video which should play on pretty much anything change the ffmpeg line to and change the custom action name to youtube2avi to avoid confusion.
This is for the YouTube stuff that is in /tmp where the YT video cached (I never worked out the purpose of many of those clever conversion apps when all you have to do is copy the file somewhere else). As far as I can tell all non-DRM/obfuscated YT content is offered h.264+aac in flash, so no need for video or audio conversion, all that's required is to put it in an mp4 container and then it will play even in dumb media players which rely on file extensions to identify content type. You could just as easily use mkv (it saves a little space). No encoding, only muxing, so very quick.
custom action:
Code: Select all
xfce4-terminal -x youtube2mp4.sh %F
Code: Select all
youtube2mp4.sh %F
Requires this script or similar to be in your path and executable.
Code: Select all
#!/bin/bash
# youtube2mp4.sh
for MOVIE in "$@" ; do
VIDOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
ffmpeg -i "$MOVIE" -acodec copy -vcodec copy "$VIDOUT".mp4
done
Code: Select all
ffmpeg -i "$MOVIE" "$VIDOUT".avi
Wisdom from my inbox: "do not mock at your pottenocy"
'Edit' script
I had several 'Edit' actions for different types of files, e.g. audacity for audio files, GIMP for image files, and so on. I decided to simplify my setup by using a Perl script that will work with 99% of the files that I open from Thunar: http://github.com/dbbolton/scripts/blob ... ar-edit.pl
I wrote it to work with only one file at a time (so %f), but a person could easily embed the existing code in a for loop over @ARGV if he so desired (%F).
Before someone yells at me for not using MIME::Types, I actually first wrote the script to use that, but ultimately I found it to be way less typing simply to list the file extensions myself. I am happy to let go of that 1% certainty.
I wrote it to work with only one file at a time (so %f), but a person could easily embed the existing code in a for loop over @ARGV if he so desired (%F).
Before someone yells at me for not using MIME::Types, I actually first wrote the script to use that, but ultimately I found it to be way less typing simply to list the file extensions myself. I am happy to let go of that 1% certainty.
Re: Post Your Thunar Custom Actions Here
Sometimes I want to know not the file size of a directory, but the playing time of the audio files within.
Command for thunar:
Appearance Conditions: Directories
Requires: oidua (in Debian main).
Works with: ogg, mp3, flac, mpc
oidua can do other things too so if you also wanted to know the file size, codec or quality it can do that as well. http://oidua.suxbad.com/
Command for thunar:
Code: Select all
xfce4-terminal -H -x oidua -o [N]" "[l] %F
Requires: oidua (in Debian main).
Works with: ogg, mp3, flac, mpc
oidua can do other things too so if you also wanted to know the file size, codec or quality it can do that as well. http://oidua.suxbad.com/
Wisdom from my inbox: "do not mock at your pottenocy"
- canci
- Global Moderator
- Posts: 2502
- Joined: 2006-09-24 11:28
- Has thanked: 136 times
- Been thanked: 136 times
Re: Post Your Thunar Custom Actions Here
Nifty! TNX. Will use that with zenity...julian67 wrote:oidua can do other things too so if you also wanted to know the file size, codec or quality it can do that as well. http://oidua.suxbad.com/
EDIT: Here is the command with zenity output:
Code: Select all
oidua -o [N]" "[l] %F | zenity --text-info
Stable / Asus VivoBook X421DA / AMD Ryzen 7 3700U / Radeon Vega Mobile Gfx (Picasso) / 8 GB RAM / 512GB NVMe
READ THIS:
* How to Post a Thread Here
* Other Tips and Great Resources
READ THIS:
* How to Post a Thread Here
* Other Tips and Great Resources
- canci
- Global Moderator
- Posts: 2502
- Joined: 2006-09-24 11:28
- Has thanked: 136 times
- Been thanked: 136 times
Re: Post Your Thunar Custom Actions Here
I use catfish, a GUI for find, locate, strigi and many more which finds your files.
http://packages.debian.org/search?keywords=catfish
http://www.twotoasts.de/index.php?/page ... mmary.html
I start it using a key shortcut which issues the following command:
--thumbnails, if you want to preview pictures, PDF and such
--wrapper tells it to use xdg-open when you double click a file, which is a desktop
agnostic database knowing what programmes open what file type.
--path is the path it's searching in.
--fileman tells it to open folders in requested file manager.
Sometimes, I want to see whether the same filename exists in other locations, so I
came up with this custom action:
Take care to choose %N here, otherwise with %f catfish is searching for something like /home/foo/bar.png and will list all things
named home or foo!
Check everything for appearance conditions.
This basically searches the same filename (and also other similar written ones --
don't know if this can be restricted via command line) on the whole system recursively.
It might be a good idea to make one for the home directory, and another one
for the entire system if you have many mount points.
EDIT: Changed %f to %N !
http://packages.debian.org/search?keywords=catfish
http://www.twotoasts.de/index.php?/page ... mmary.html
I start it using a key shortcut which issues the following command:
Code: Select all
catfish --thumbnails --path=/home/canci --wrapper=xdg-open --fileman=thunar
--wrapper tells it to use xdg-open when you double click a file, which is a desktop
agnostic database knowing what programmes open what file type.
--path is the path it's searching in.
--fileman tells it to open folders in requested file manager.
Sometimes, I want to see whether the same filename exists in other locations, so I
came up with this custom action:
Code: Select all
catfish --thumbnails --path=/ --wrapper=xdg-open --fileman=thunar %N
named home or foo!
Check everything for appearance conditions.
This basically searches the same filename (and also other similar written ones --
don't know if this can be restricted via command line) on the whole system recursively.
It might be a good idea to make one for the home directory, and another one
for the entire system if you have many mount points.
EDIT: Changed %f to %N !
Last edited by canci on 2010-10-31 15:29, edited 1 time in total.
Stable / Asus VivoBook X421DA / AMD Ryzen 7 3700U / Radeon Vega Mobile Gfx (Picasso) / 8 GB RAM / 512GB NVMe
READ THIS:
* How to Post a Thread Here
* Other Tips and Great Resources
READ THIS:
* How to Post a Thread Here
* Other Tips and Great Resources
- canci
- Global Moderator
- Posts: 2502
- Joined: 2006-09-24 11:28
- Has thanked: 136 times
- Been thanked: 136 times
Re: Post Your Thunar Custom Actions Here
LaTeX Preview
A script which compiles your latex in a temporary folder with nice output in a terminal,
displays it in a PDF viewer and after closing deletes the temporarily created file and
folder.
Change "evince" in the script above to any PDF viewer you like.
Make the script executable and copy it into /usr/local/bin.
I named it "pdflatpreview"
This code is the custom action:
Change lxterminal to your preferred terminal.
A script which compiles your latex in a temporary folder with nice output in a terminal,
displays it in a PDF viewer and after closing deletes the temporarily created file and
folder.
Code: Select all
#!/bin/bash
cd $HOME &&
mkdir .TMP_LAT &&
cd .TMP_LAT &&
pdflatex $1 &&
evince *.pdf &&
cd $HOME &&
rm -r .TMP_LAT
Make the script executable and copy it into /usr/local/bin.
I named it "pdflatpreview"
This code is the custom action:
Code: Select all
lxterminal -e "pdflatpreview %f"
Stable / Asus VivoBook X421DA / AMD Ryzen 7 3700U / Radeon Vega Mobile Gfx (Picasso) / 8 GB RAM / 512GB NVMe
READ THIS:
* How to Post a Thread Here
* Other Tips and Great Resources
READ THIS:
* How to Post a Thread Here
* Other Tips and Great Resources
Lossless 2-click image rotation
Rotate your images from the right click menu.
Rotate Right
jpegtran -rotate 90 -copy all -outfile %f %f
Appearance Conditions:
*.jpg;*.JPG
Image Files
Rotate Left
jpegtran -rotate 270 -copy all -outfile %f %f
Appearance Conditions:
*.jpg;*.JPG
Image Files
Rotate Right
jpegtran -rotate 90 -copy all -outfile %f %f
Appearance Conditions:
*.jpg;*.JPG
Image Files
Rotate Left
jpegtran -rotate 270 -copy all -outfile %f %f
Appearance Conditions:
*.jpg;*.JPG
Image 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
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G
Re: Lossless 2-click image rotation
You could also use convert (from the imagemagick package) for a more general solution: http://www.imagemagick.org/script/comma ... 8q3#rotatemzilikazi wrote:Rotate your images from the right click menu.
Rotate Right
jpegtran -rotate 90 -copy all -outfile %f %f
Appearance Conditions:
*.jpg;*.JPG
Image Files
Rotate Left
jpegtran -rotate 270 -copy all -outfile %f %f
Appearance Conditions:
*.jpg;*.JPG
Image Files
- canci
- Global Moderator
- Posts: 2502
- Joined: 2006-09-24 11:28
- Has thanked: 136 times
- Been thanked: 136 times
Re: Post Your Thunar Custom Actions Here
GPicView is in the repositories and has few dependencies. It is an image viewer which lets you rotates images
and then also save them into various formats. Of course, rotation is only limited to 90° CW or CCW, so not nearly as potent as a script.
I find it to be much lighter than Ristretto. It's part of the LXDE project.
and then also save them into various formats. Of course, rotation is only limited to 90° CW or CCW, so not nearly as potent as a script.
I find it to be much lighter than Ristretto. It's part of the LXDE project.
Stable / Asus VivoBook X421DA / AMD Ryzen 7 3700U / Radeon Vega Mobile Gfx (Picasso) / 8 GB RAM / 512GB NVMe
READ THIS:
* How to Post a Thread Here
* Other Tips and Great Resources
READ THIS:
* How to Post a Thread Here
* Other Tips and Great Resources
Re: Post Your Thunar Custom Actions Here
Hmm this thread needs a subscriber =)
lots and lots of useful commands in here
lots and lots of useful commands in here
Rename your .jpg images to EXIF date
This is a quick way to rename alot of images to something more useful than DSCF3727.JPG
New Action>
Name: Rename To EXIF Date
Description: Rename image file to EXIF date/time
Command: /path/to/RenameToExifDate %F
Code: Select all
apt-get install jhead
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
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
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G
Re: Rename your .jpg images to EXIF date
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.mzilikazi wrote:This is a quick way to rename alot of images to something more useful than DSCF3727.JPGNew Action>Code: Select all
apt-get install jhead
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
You could use a rename expression such as
Code: Select all
rename 'if ($_=~/^(.*\.)([A-Z]+)$/) { $_=$2; tr/[A-Z]/[a-z]/; $_=$1.$_}' *
Re: Rename your .jpg images to EXIF date
Opps you're right - changed it to %Fdbbolton wrote: It looks to me like the top part acts on a single file (since %f is the first selected file),
My camera always names everything with the .JPG extension so these tasks are actually quite perfect together.It seems like these tasks would better be separated-.
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
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G
Re: Rename your .jpg images to EXIF date
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.mzilikazi wrote:My camera always names everything with the .JPG extension so these tasks are actually quite perfect together.
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
How about:
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
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).
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
Appearance conditions:
*.JPG;*.jpg;*.JPEG;*.jpeg
Thunar Command
Code: Select all
xfce4-terminal -H -x rename2exif.sh %F
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"
Copy /path/to/file & Copy file contents
Found this somewhere in the Xfce docs:
Copy /path/to/file to clipboard:
Appearance conditions:
*
ALL
Copy file contents to clipboard
Appearance conditions
*.txt;*.TXT
Text Files
Copy /path/to/file to clipboard:
Code: Select all
echo -n %f|/usr/bin/xclip -selection c
*
ALL
Copy file contents to clipboard
Code: Select all
xclip -in -selection c < %f
*.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
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G