Post Your Thunar Custom Actions Here

Use this forum for questions related to graphics, sound or desktop environments.

Post Your Thunar Custom Actions Here

Postby julian67 » June 10th, 2011, 9:12 pm

This is copied from my original thread at the fdn re-education camp. I decided I would also rip off other people's content and hope they either don't notice or don't care or can't do anything about it anyway. So here's the original post and following it will be the other custom actions various people posted.

Thunar seems to some people to be a very simple file manager, in fact I've seen this asserted quite a few times in various places such as reviews, blogs, vitriolic trolling complaints and so on. It's not actually true but it does look quite limited if you don't care to scratch the surface, read a doc or even just click around with your mouse and see what lurks in the menu. But in fact it's far more versatile than first appearances suggest because it supports custom actions (user created context menu entries) in a very neat way, making it possible to create even quite complex actions very easily and take advantage of the applications and utilities on your system, all from within the file manager. Post your favourites here!

A couple of simple ones:

Slideshow

This requires feh

This will take the images in the directories and/or files you select and display them in a fullscreen slideshow, 3 seconds per image. Use the keyboard h to pause the show and v to show the images actual (1:1) size.

Image

Thunar is missing one facility found in most other file managers, the ability to highlight several directories and/or files and have the total size displayed. So I made a custom action:

How Big?

Image

So I highlight some files and directories and use the 'How Big?' right click entry:

Image

and get this:

Image


I'll post a few more later, just wanted to get things started for now.

So please post your Thunar custom actions, simple or complex. Explain what they do, which applications they use, and if they call a custom script please post that as well. Ideally post screenshots as well but please keep the size reasonable and the text legible. I find scaling the dialogue boxes to 80% satisfies this, and posting a clickable thumb is better if you need to show a substantial part of the desktop.
User avatar
julian67
 
Posts: 249
Joined: February 9th, 2011, 12:59 pm

Re: Post Your Thunar Custom Actions Here

Postby julian67 » June 10th, 2011, 9:20 pm

.m3u playlist generator

Script (to be executable and in your path):

Code: Select all
#! /bin/bash
# playgen
# a playlist generator

for i in "$@" ; do

cd "$i"
OUT=`echo ${PWD##*/}`
ls -w 1 |egrep *.'[fF][lL][aA][cC]|[aA][pP][eE]|[wW][vV]|[wW][aA][vV]|[mM][pP][3]|[aA][aA][cC]|[oO][gG][gG]|[oO][gG][aA]|[wW][mM][aA]|[mM][pP][cC]|[mM][4][aA]' \
>"$OUT".m3u
done


Basic:
Name: anything you like
Command: playgen %F

Appearance Conditions: Directories
File Pattern: *

Right click on your target directory "foosingers - greatest hits". Playlist will be simple format .m3u "foosingers - greatest hits/foosingers - greatest hits.m3u"
User avatar
julian67
 
Posts: 249
Joined: February 9th, 2011, 12:59 pm

Re: Post Your Thunar Custom Actions Here

Postby julian67 » June 10th, 2011, 9:21 pm

Convert any and all selected audio files to Ogg Vorbis -q 7 while retaining all tags including cover art and replay gain. Filenames including spaces and bad characters such as ( or . are allowed.

edit: this and the following script requires gstreamer0.10-plugins-base & gstreamer0.10-plugins-good and the mp3 script requires gstreamer0.10-plugins-bad. For those of you who have a morbid fear of the letter g: don't worry. Gstreamer is not GTK or Gnome, has no dependencies on them and doesn't require any graphical desktop. It's a multimedia framework written in C.

Image

This requires the following script to be in your path and in this custom action it's called ogggst.sh but name it to whatever you prefer:

Code: Select all
#!/bin/bash

for TRACK in "$@" ; do

# allow filenames containing dots such as "an artist feat. some_other_artist"
OGGOUT=$(ls "$TRACK" |sed 's/\(.*\)\..*/\1/')

gst-launch filesrc location="$1" ! decodebin ! audioconvert ! \
vorbisenc name=enc quality=0.7 ! oggmux ! filesink location="$OGGOUT.ogg"
done
User avatar
julian67
 
Posts: 249
Joined: February 9th, 2011, 12:59 pm

Re: Post Your Thunar Custom Actions Here

Postby julian67 » June 10th, 2011, 9:22 pm

Convert any and all selected audio files to mp3 VBR (using Lame quality V 4) while retaining all tags including cover art (but not replay gain). This writes the tags with ID3v2.3 but doesn't write ID3v1.1 or 2.4. This makes the tags readable by any software or hardware audio player or tagging tools which aren't desperately bad or unmaintained for years. Filenames including spaces and bad characters such as ( or . are allowed.

The appearance conditions have to be slightly different than for the ogg script. Of course they need to exclude already existing mp3s, but also these days Debian sees .ogg as Video and .oga as Audio, so the condition allows Video files but the list of allowed extensions includes only likely audio types. This is my list: *.ogg;*.flac;*.wv;*.wav;*.mpc;*.ape;*.shn


Image

This requires the following script to be in your path and in this custom action it's called mp3gst.sh but name it to whatever you prefer:

Code: Select all
#!/bin/bash

for TRACK in "$@" ; do

# allow filenames containing dots such as "an artist feat. some_other_artist"
MP3OUT=$(ls "$TRACK" |sed 's/\(.*\)\..*/\1/')

gst-launch filesrc location="$TRACK" ! decodebin! audioconvert ! \
lame name=enc mode=4 vbr=4 vbr-quality=4 ! xingmux ! id3mux ! \
filesink location="$MP3OUT.mp3"
done
User avatar
julian67
 
Posts: 249
Joined: February 9th, 2011, 12:59 pm

Re: Post Your Thunar Custom Actions Here

Postby julian67 » June 10th, 2011, 9:23 pm

Mount and unmount ISO, BIN, IMG, MDF disk images:

This requires fuseiso and that the user is a member of the fuse group.

Mount:

Image

command:
Code: Select all
fuseiso -n -p %f %f.mount


appearance conditions:
Code: Select all
*.iso;*.ISO;*.bin;*.BIN;*.nrg;*.NRG;*.mdf;*.MDF


Unmount:

Image

command:
Code: Select all
fusermount -u %f


appearance conditions:
Code: Select all
*.mount
User avatar
julian67
 
Posts: 249
Joined: February 9th, 2011, 12:59 pm

Re: Post Your Thunar Custom Actions Here

Postby julian67 » June 10th, 2011, 9:23 pm

Enqueue and Play in MPlayer

Only the GUI version of mplayer supports -enqueue, but fortunately the non-gui version will load a playlist so it's possible to have a custom action which creates a playlist of all selected files and then opens mplayer and plays them in sequence. This works fine for one file or many:

Image

command:
Code: Select all
ls -w 1 %F >/tmp/mplist && mplayer -playlist /tmp/mplist


MPlayer opens with window decoration but not the gmplayer controls so you can move the mplayer window around and resize it in the normal way (and it keeps aspect ratio on resize unlike gmplayer) and control it with the usual keyboard commands or OSD menu.

MPlayer play 30 second sample of each file:

same as above, using a different playlist name and with a start position of 120 seconds (opening credits/titles are not very interesting, don't let you check subtitles and alternative audio streams and anyway those FBI warnings are way too scary). Plays for 30 seconds and then moves to next item in playlist.

Code: Select all
ls -w 1 %F >/tmp/mpvlist && mplayer -ss 120 -endpos 30 -playlist /tmp/mpvlist
User avatar
julian67
 
Posts: 249
Joined: February 9th, 2011, 12:59 pm

Re: Post Your Thunar Custom Actions Here

Postby julian67 » June 10th, 2011, 9:25 pm

from mephjones http://forums.debian.net/viewtopic.php?p=285321#p285321

I use this one to TeX files to PDF because pdftex doesn't handle my figures correctly:

Code: Select all
xterm -e 'TEXMFHOME=~/.local/share/texmf tex `basename %N .tex` && dvipdf `basename %N .tex` && rm -f `basename %N .tex`.log `basename %N .tex`.dvi'


The TEXMFHOME assignment should be changed or removed, of course. Running in xterm allows me to edit in a terminal window if there is an error.

Also, I use this for converting my scans to Djvu format:

Code: Select all
for i in %F; do c44 $i; done


I use for loops to do actions on several files when a command only works on one file at a time.
User avatar
julian67
 
Posts: 249
Joined: February 9th, 2011, 12:59 pm

Re: Post Your Thunar Custom Actions Here

Postby julian67 » June 10th, 2011, 9:26 pm

from mephjones again http://forums.debian.net/viewtopic.php?p=285354#p285354

I use this ugly hack for encryption. Any suggestions for improvement? (Requires zenity)

Code: Select all
xterm -e 'zenity --text "Enter Passphrase:" --entry --hide-text| gpg --passphrase-fd 0 -c %f'
User avatar
julian67
 
Posts: 249
Joined: February 9th, 2011, 12:59 pm

Re: Post Your Thunar Custom Actions Here

Postby julian67 » June 10th, 2011, 9:26 pm

mephjones wrote:I use this ugly hack for encryption. Any suggestions for improvement? (Requires zenity)

Code: Select all
xterm -e 'zenity --text "Enter Passphrase:" --entry --hide-text| gpg --passphrase-fd 0 -c %f'



Try this:
Code: Select all
xfce4-terminal --hide-menubar --hide-toolbars --geometry=70x10 -x gpg -c %f
User avatar
julian67
 
Posts: 249
Joined: February 9th, 2011, 12:59 pm

Re: Post Your Thunar Custom Actions Here

Postby julian67 » June 10th, 2011, 9:28 pm

from bugsbunny http://forums.debian.net/viewtopic.php?p=286096#p286096

For mounting/unmounting images I use a modified method, adapted from a nautilus action I was running (my desktop is out of commission due to hardware problems (either power supply or motherboard) so I'm now on a laptop that isn't completely configured yet, but I'm close. Using xfce on this setup)

Instead of calling fuseiso directly I call a bash script. This enables me to mount (and unmount) multiple images in 1 shot. When mounting the last iso mounted gets opened in your file manager (thunar by default).

Mountpoints are on your desktop, but you can easily change that. I store the scripts in ~/bin/

mountiso script

Code: Select all
#!/bin/bash
while [ $1 ]; do
  ISONAME=${1##*/}
  mkdir ~/Desktop/"$ISONAME".mount
  fuseiso "$1" ~/Desktop/"$ISONAME".mount|| rmdir ~/Desktop/"$ISONAME".mount
  sleep 1
  shift
done
[ -d ~/Desktop/"$ISONAME".mount ] && exo-open ~/Desktop/"$ISONAME".mount >/dev/null
exit


umountiso script

Code: Select all
#!/bin/bash
while [ $1 ]; do
  fusermount -uz "$1"
  rmdir "$1"
  shift
done
exit
User avatar
julian67
 
Posts: 249
Joined: February 9th, 2011, 12:59 pm

Next

Return to Desktop & Multimedia

Who is online

Users browsing this forum: Baidu [Spider] and 0 guests

cron

x