| Author | Topic: Thunar - custom actions (Read 3,953 times) |
Richard Elder Member
     member is offline
![[avatar] [avatar]](http://dl.dropbox.com/u/10332409/bender.gif)
Joined: Jan 2011 Gender: Male  Posts: 586 Location: Venezuela
|  | Re: Thunar - custom actions « Reply #30 on Dec 31, 2011, 12:31am » | |
I must have something wrong. Neither Mount-ISO nor Unmount-ISO seem to do anything. If Directories not checked, doesn't show, and, with Directories checked, still doesn't mount, according to "mount" in terminal. Nor with the Bookmark in tree view.
Something to think about. All the rest seem to be fine and really useful.
|
SalineOS-1.7, Xfce4.6.2, w/ 3.2.0-0.bpo.4-686-pae; SalineOS-2.0, Xfce4.8, w/ 3.2.0-4-686-pae Fedora-18, Xfce4.10, w/ 3.8.x
|
|
Anthony Nordquist Administrator
     member is offline
![[homepage] [homepage]](http://images.proboards.com/new/buttons/www_sm.png) Joined: Dec 2010 Gender: Male  Posts: 1,336
|  | Re: Thunar - custom actions « Reply #31 on Dec 31, 2011, 1:23am » | |
Dec 31, 2011, 12:31am, Richard wrote:I must have something wrong. Neither Mount-ISO nor Unmount-ISO seem to do anything. If Directories not checked, doesn't show, and, with Directories checked, still doesn't mount, according to "mount" in terminal. Nor with the Bookmark in tree view.
Something to think about. All the rest seem to be fine and really useful.
|
|
Mount ISO should only show when you have nothing but a single ISO file selected. Once you click Mount ISO it will create a mount point at /mnt/file-name and then mount the selected ISO there. Then it should launch a Thunar instance and show it to you. It is possible the mount command hung at some point and is not actually running properly, try rebooting the machine and trying again.
The Umount command ONLY works if the ISO is mounted to /mnt/file-name, it is meant really to work with the mount custom action.
| |
|
mihail Full Member
   member is offline
Joined: Dec 2011 Gender: Male  Posts: 120 Location: Romania
|  | Re: Thunar - custom actions « Reply #32 on Dec 31, 2011, 7:38am » | |
@ Anthony,
regarding your updated script, you said something about not including the ffmpeg cmds, so:
1 - this means that the cmds in one of your previous messages work if I edit the thunar custom file, because I have ffmpeg? Its just that you havent included in your latest custom cfg?
2 - how about rotating images? Have you included the function or not? You only mention conversion between img cd/dvd's.
Thanks for the clarifications... and for your dedicated work...
|
|
|
Anthony Nordquist Administrator
     member is offline
![[homepage] [homepage]](http://images.proboards.com/new/buttons/www_sm.png) Joined: Dec 2010 Gender: Male  Posts: 1,336
|  | Re: Thunar - custom actions « Reply #33 on Dec 31, 2011, 10:28am » | |
Dec 31, 2011, 7:38am, mihail wrote:@ Anthony,
regarding your updated script, you said something about not including the ffmpeg cmds, so:
1 - this means that the cmds in one of your previous messages work if I edit the thunar custom file, because I have ffmpeg? Its just that you havent included in your latest custom cfg?
2 - how about rotating images? Have you included the function or not? You only mention conversion between img cd/dvd's.
Thanks for the clarifications... and for your dedicated work... |
|
To answer your first question, yes you can add them and use them as is. My post includes all the information you need.
To answer the second one, I have decided against adding a rotate custom action by default. Fotoxx (Included by default) will rotate images for you and can rotate them any number of degrees the user desires, a custom action will only rotate them a set number. I may write up a big long script using Zenity and Image Magic in the future, but this would require a good deal of time to write and an even longer period to test. For the time being I would recommend adding your own custom action, read on for instructions 
Adding custom actions is really quite easy, to setup the rotate JPEGs you will need to:
1. Open up Thunar and click the Edit menu entry and select Configure Custom Actions.
2. Click the Add button on the side pane.
3. Input a name, this is what will appear in your menu when you right click on a JPEG.
4. Input a description, this can be whatever you want.
5. Paste this line into the Command field: for file in %F; do tempfile=$(mktemp); (jpegtran -copy all -rotate 90 $file > $tempfile); mv -f $tempfile $file; rm -f $tempfile; done
6. Optionally click on the button labeled No Icon and select an icon for it.
7. Click the Appearance and Conditions tab and uncheck Text files, click Other and enter this in the text entry box: *.jpg;*.JPG;*.jpeg;*.JPEG
You will need to install the package libjpeg-prog before you can use this custom action.
You can make the ffmpeg custom actions the exact same way. Just paste the information in place. Speaking of ffmpeg, I have written a conversion script on top of ffmpeg that you can use to make a custom action. Keep in mind that this script is literally a 15 minute script and will probably live up to the name I gave it. (Don't expect it to work 100% of the time)
To install input this into your terminal: cd $HOME wget http://www.salineos.com/Scripts/not-so-smart-converter && gksu 'mv -f ./not-so-smart-converter /usr/bin' && chmod +x /usr/bin/not-so-smart-converter
Then create a custom action like described above. Enter this into the command line: not-so-smart-converter %f Under the Appearance Conditions un-check Text files and check Video files.
I am going to go ahead and enter this script into the public domain. If anyone wants to pick it up and make it a bit smarter they are more than welcome.
| |
|
mihail Full Member
   member is offline
Joined: Dec 2011 Gender: Male  Posts: 120 Location: Romania
|  | Re: Thunar - custom actions « Reply #34 on Dec 31, 2011, 1:07pm » | |
@Anthony
1 - I am very grateful for your time and very clear (this is very important) explanations, Anthony. I will enter the comands when I will have a bit more time, and maybe asociate some icons with them and upload the file, in case other will be interested.
2 - Fotoxx, mirage or any other viewer can do this things but it takes more to load the thumbnails, than Thunar does. I have a friend who is a historian and he goes and takes photos of files from archieve and opens a preview in win7, there on each picture it has a rotate arrow, and it rotates them very quickly, while in other viewers needs 3 times more... So maybe not all use this, but it is very important...
as for the video part, there is a 3gpwiz script for kommander that i had in mind when i wrote about conversion... Will add also the video cmds in the cfg...
thanks again
|
|
|
mihail Full Member
   member is offline
Joined: Dec 2011 Gender: Male  Posts: 120 Location: Romania
|  | Re: Thunar - custom actions « Reply #35 on Dec 31, 2011, 1:42pm » | |
aaaah and whats the purpose of bookmarks? i'm kind of missing what it does
|
|
|
petrek Senior Member
    member is offline
![[avatar] [avatar]](http://img543.imageshack.us/img543/3784/avatarebm.jpg)
Joined: Aug 2011 Gender: Male  Posts: 386 Location: Poland
|  | Re: Thunar - custom actions « Reply #36 on Dec 31, 2011, 1:57pm » | |
Thanks, but I'm always forgetting about adding bookmarks. So I wrote my own script. For better experience it needs gamin installed. And here it is. I tested it a little bit, hope it has no big bugs It suppose to show the last ten directories, in which files were run. It also preserves added bookmarks. Database is small text file. I'm thinking about adding last files also, but either in main menu or as a custom action (and that's why I have question, is there any possibility to create Sub menu, like that in Send To?). I called it remedir. It needs to be put in /usr/bin. For example to add bookmarks it needs to be run like this: remedir parole /home/username/video.mp4
Code:#!/bin/bash if [ -n "$2" ]; then tmpv=$(echo "$2" | grep "file://") if [ -n "$tmpv" ]; then ver="$2" else ver="file://$2" fi cat $HOME/.gtk-bookmarks $HOME/.config/Thunar/history.txt | sort | uniq -u > $HOME/.config/Thunar/.gtk-bookmarks.diff ver2=$(echo "$ver" | sed 's/\/[^\/]*$//g') cat $HOME/.config/Thunar/history.txt | grep -v "$ver2" > /tmp/histmp.txt tmpv=$(cat $HOME/.config/Thunar/.gtk-bookmarks.diff | grep -m 1 "$ver2" ) if [ ! -n "$tmpv" ]; then echo "$ver2" >> /tmp/histmp.txt numlines=$(wc -l /tmp/histmp.txt | tr " " "\n" | head -n 1) sum=$(($numlines-9)) if test "$numlines" -gt "10"; then tail -n +"$sum" /tmp/histmp.txt > $HOME/.config/Thunar/history.txt else cp /tmp/histmp.txt $HOME/.config/Thunar/history.txt fi cat $HOME/.config/Thunar/.gtk-bookmarks.diff $HOME/.config/Thunar/history.txt > $HOME/.gtk-bookmarks fi fi exec "$@"
|
|
|
Skallagrigg |
|
Anthony Nordquist Administrator
     member is offline
![[homepage] [homepage]](http://images.proboards.com/new/buttons/www_sm.png) Joined: Dec 2010 Gender: Male  Posts: 1,336
|  | Re: Thunar - custom actions « Reply #37 on Dec 31, 2011, 7:03pm » | |
That is quite the clever script, though I am inclined not to slow down Thunar by including it. I like my somewhat simpleton bookmarks.
@mihail The bookmarks custom action creates a symlink to the folder you select in the folder /home/user/bookmarks. This makes navigating to a directory quite a bit faster at times, for example WINE folder would be /home/user/.wine/drive_c/Program Files, when bookmarked you can get there from /home/user/Bookmarks/Program Files. Bypasses the need to show hidden files and find .wine in the huge cluster of them that inevitably inhabit the users home directory. It may not be the most useful custom action ever, but I thought it had enough of a use to include.
| |
|
petrek Senior Member
    member is offline
![[avatar] [avatar]](http://img543.imageshack.us/img543/3784/avatarebm.jpg)
Joined: Aug 2011 Gender: Male  Posts: 386 Location: Poland
|  | Re: Thunar - custom actions « Reply #38 on Dec 31, 2011, 7:12pm » | |
Well, I wrote it for myself, and if someone wants to use it there is source code By the way, bookmarks are not necessary (or maybe I'm missing something?), you can add Bookmark right clicking the file, choosing Send To -> Side Pane
|
Skallagrigg |
|
Anthony Nordquist Administrator
     member is offline
![[homepage] [homepage]](http://images.proboards.com/new/buttons/www_sm.png) Joined: Dec 2010 Gender: Male  Posts: 1,336
|  | Re: Thunar - custom actions « Reply #39 on Dec 31, 2011, 7:16pm » | |
O.O I wonder why, in all this time, I have never realized that I could add things to the side pane so easily. Apparently I was missing something, that is a nice feature I must say. I forgot to mention, as of right now I do not believe you can make a sub-menu in custom actions. You could always use the zenity --list function though, which will create a little popup window.
| |
|
petrek Senior Member
    member is offline
![[avatar] [avatar]](http://img543.imageshack.us/img543/3784/avatarebm.jpg)
Joined: Aug 2011 Gender: Male  Posts: 386 Location: Poland
|  | Re: Thunar - custom actions « Reply #40 on Jan 1, 2012, 2:59am » | |
As they say, man is learning all his/her life Thanks, so I'll try to put it in the main menu then.
|
Skallagrigg |
|
mihail Full Member
   member is offline
Joined: Dec 2011 Gender: Male  Posts: 120 Location: Romania
|  | Re: Thunar - custom actions « Reply #41 on Jan 1, 2012, 10:34am » | |
Thanks Anthony, you are right about the bookmarks, some paths are really long! It was good and usefull for all that you have included it in your cfg.
|
|
|
mihail Full Member
   member is offline
Joined: Dec 2011 Gender: Male  Posts: 120 Location: Romania
|  | Re: Thunar - custom actions « Reply #42 on Jan 1, 2012, 11:25am » | |
Code:# cd $HOME wget [url]http://www.salineos.com/Scripts/not-so-smart-converter[/url] && gksu 'mv -f ./not-so-smart-converter /usr/bin' && chmod +x /usr/bin/not-so-smart-converter Eroare GConf: Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. See [url]http://projects.gnome.org/gconf/[/url] for information. (Details - 1: Nu s-a reușit conectarea la sesiune: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.) Eroare GConf: Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. See [url]http://projects.gnome.org/gconf/[/url] for information. (Details - 1: Nu s-a reușit conectarea la sesiune: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.) Eroare GConf: Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. See [url]http://projects.gnome.org/gconf/[/url] for information. (Details - 1: Nu s-a reușit conectarea la sesiune: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.) mv: nu se poate face stat „./not-so-smart-converter”: No such file or directory root@cpd:~#
|
|
cant download your not so smarty video converter Anthony... Couldnt connect to server from what I can tell... Is the path ok?
|
|
|
mihail Full Member
   member is offline
Joined: Dec 2011 Gender: Male  Posts: 120 Location: Romania
|  | Re: Thunar - custom actions « Reply #43 on Jan 1, 2012, 7:49pm » | |
also, the imags arent rotating...
video conversion works and also extraction of audio from video
|
|
|
Anthony Nordquist Administrator
     member is offline
![[homepage] [homepage]](http://images.proboards.com/new/buttons/www_sm.png) Joined: Dec 2010 Gender: Male  Posts: 1,336
|  | Re: Thunar - custom actions « Reply #44 on Jan 1, 2012, 9:43pm » | |
I have created a self extracting archive with a handful of new custom actions, installing this will overwrite the old custom scripts file and should NOT be run on Debian testing or Sid. You can install it by inputting the following line in a root terminal:
wget http://www.salineos.com/Scripts/customactions.run && chmod +x ./customactions.run && ./customactions.run
This will install all the needed dependencies and prompt you to reboot when done. Added in this file is: Rotate image(s) 90 180 or 270 degrees (Zenity list to choose which) Resize image(s) by percentage Scale Image(s) to a pre-defined size, I included the most common resolutions for mobile devices and PC displays. Also, you can select custom and enter your own. Convert Image(s), converts the file format of the selected image(s). Convert .nrg files(Created by Nero on Windows) to .iso files Mark As Executable, marks the selected file(s) executable
This archive also has a modified unconv deb file, this means it can be installed without going through the irrelevant warnings of aptitude.
*I will make a post later going over all the custom actions and how to install them one by one, in case you don't want to overwrite your current file. Also, if you want to use/share the custom actions on a non stable based system.
And here we go  These are the current custom actions I will be including in 1.6 and that you can get via the archive above. The archive includes all the scripts I wrote to be accessed by these commands and will use apt to pull in the other needed dependencies. A great deal of these require Zenity, so I will not be posting it in the notes. Without further ado:
Name: Open Terminal Here Command: exo-open --working-directory %f --launch TerminalEmulator Note: This is a default custom action, you should already have this.
Name: Open Root Terminal Here Command: gksu 'xfce4-terminal --working-directory=%f' Note: Only shows if your selecting a directory
Name: Open Directory As Root Command: gksu thunar %f
Name: Edit As Root Command: gksu mousepad %f Note: You can simply change mousepad to gedit or any other text editor if you want. Text files only.
Name: Mark As Executable Command: chmod +x %F Note: Works on multiple files, only shows for text files.
Name: Search For Files or Folders Command: catfish --fileman=thunar --hidden --path=%f%d Note: Shows hidden files, shows on Directories.
Name: "Burn" Image To USB Drive Command: gksu "image-to-usb %f" Note: Requires http://www.salineos.com/Scripts/image-to-usb to be placed in /usr/bin and marked executable. Shows on Other > *.iso;*.img
Name: Mount ISO Command: gksu 'mkdir -p /mnt/%n' && gksu 'mount -o loop -t iso9660 %f /mnt/%n' && thunar '/mnt/%n' Note: Show on Other>*.iso
Unmount ISO Command: gksu 'umount /mnt/%n' Note: Show on Other > *.iso requires that the ISO is mounted with the above command to work (Unless you happened to mount it manually there).
Name: Convert to IMG Command: dmg2img -s %f Note: Show on Other > *.dmg Requires the package dmg2img According to Wikipedia dmg files are generated by Apple computers 
Name: Convert To ISO Command: mdf2iso %f Note: Show on Other > *.mdf Requires the package mdf2iso. Again Wikipedia mentions that .mdf files are created by Alcohol 120%, a Windows program that apparently uses a stupid proprietary image format.
Name: Convert To ISO Command: ccd2iso %f %f.iso | mv %f.iso $(echo %f.iso | sed 's|.img||g') Note: Show on Other > *.img Can be used in conjunction with dmg2img to turn Apple formats into something useful. Requires installing the package ccd2iso
Name: Convert To ISO Command: nrg2iso %f %f.iso | mv %f.iso $(echo %f.iso | sed 's|.nrg||g') Note: Show on Other > *.nrg Wikipedia tells me that nrg files are yet another stupid file format, this one used by Nero burning rom (Which apparently isn't something you catch from a bar fly, who knew ) Requires the package nrg2iso.
Name: Disk Usage Utility Command: du -chs --apparent-size %N | zenity --text-info Note: There are tons of ways to create a disk usage utility, I like this one the best. You could make one using baobab which is pre-installed on SalineOS.
Name: Checksum Command: zenity --info --title="Check md5 for %n" --text="$(md5sum %f)" | zenity --progress --percentage="40" --auto-kill --auto-close --title="Checksum utility" --text="Calculating md5sum for %n" Note: The progress bar doesn't actually move, which isn't too much of a problem since it shouldn't take TOO long to run the checksum. It just takes long enough that I think it should appear to be doing something. Show on other *.iso
Name: Convert To ODT Command: unoconv -f odt %F Note: Requires the package unoconv and OpenOffice or Libre Office. It will launch an instance of the installed office suite when run, this is unavoidable. Makes a copy of file in .odt. Show on Other > *.doc;*.docx
Name: Convert To PDF Command: unoconv -f pdf %F Note: Requires the package unoconv and OpenOffice or Libre Office. It will launch an instance of the installed office suite when run, this is unavoidable. Makes a copy of file in .pdf. Show on Other > *.doc;*.docx;*.odt;*.odp;*.pps;*.ppt;*.xls;*.xlsx;*.ods;*.pptx
The next four all require the package imagemagick which is an INCREDIBLY powerful command line tool for manipulating images. Feel free to use my scripts as a template for any other functions imagemagick can do, reading the manual page for the convert script of imagemagick will blow your mind with functionality (The command man convert).
The respective scripts for the next section can be had here: http://www.salineos.com/Scripts/convert-image-ca http://www.salineos.com/Scripts/resize-image-ca http://www.salineos.com/Scripts/rotate-image-ca http://www.salineos.com/Scripts/scale-image-ca
You will need to move them to /usr/bin and make them executable.
Name: Convert Image(s) To... Command: convert-image-ca %F Note: Shown on Images, uses a Zenity list to ask you what format you want to convert the image(s) to. Makes a copy of the image with the name filename.newextension
Name: Scale Image(s) To... Command: scale-image-ca %F Note: Shown on Images, includes a Zenity list with the most popular resolutions of mobile devices and PC displays. Also includes a custom option that will allow you to specify any size you want. Makes a copy named filename-newsize(such as 800x600)
Name: Resize Image(s) By % Command: resize-image-ca %F Note: Shown on Images, Zenity list of percentages 10-200 with increments of 5% Makes a copy named filename-RESIZED
Name: Rotate Image(s) Command: rotate-image-ca Note: Shown on Images, Zenity list with 3 choices, 90 180 and 270 degrees. This is the only one of the image custom actions that applies directly to the image instead of making a copy (You can always rotate it back).
Not included in the archive and won't be on 1.6 but still useful:
Name: Convert Video To.. Command: not-so-smart-converter %f Note: Requires http://www.salineos.com/Scripts/not-so-smart-converter This script is an overly simplified Zenity front-end to ffmpeg. If ffmpeg -i input-file-name.ext output-file-name.ext will convert the file properly so will this script. This script is a public domain work, if someone wants to continue the development and take all the credit for it more power to them.
| |
| |
|