Adding Custom Actions to File Manager
We are going to be adding customer actions to file manager, to both XFCE Thunar and the Nemo file managers.
XFCE Thunar (file manager)
First open you Thunar file manager, go to Edit then click on Configure custom actions.
Find the Search action and click on it then Select Edit from the right hand side menu then make sure in the Command section it has ( catfish –path=%f ). If not copy and paste into the Command section. Then hit OK then close and restart Thunar. Now, re-open Thunar and click on File then the Search and it will open Catfish in the directory you’re currently in. Do your search.
So lets say you want to add the Gnome search tool. (Has a few more search options) So we need to install from Synaptic package manager the following package ( gnome-search-tool ). After it’s installed close Synaptic package manager. Open your Thunar file manager, go to Edit then click on Configure custom actions. On the right hand side click on The (+) for Add Custom Action.
Under Name: Put in ( Search Gnome ), in the Description: Put in ( Gnome Search Tool ), in the Command: Put in ( gnome-search-tool –path=%f )
Then hit OK then close and restart Thunar. Now, re-open Thunar and click on File then the Search Gnome and it will open Gnome Search in the directory you’re currently in. Do your search. You will see a few more search options now.
Now lets try adding Edit file as Root. You have a file like fstab that you need to edit, so instead of open the file manager in root then find the file again and open as root we will create a command that when we right mouse click on the file we wish to open (Edit as Root ) command will let us open as root.
Open your Thunar file manager, go to Edit then click on Configure custom actions. On the right hand side click on The (+) for Add Custom Action.
Under Name: Put in ( Edit as Root ), in the Description: Put in ( Edit file as Root ), in the Command: Put in ( gksu gedit %f )
Then hit OK then close and restart Thunar. Now, re-open Thunar and right click on and document then click on Edit as Root and it will open Gedit and you can edit the file in root mode. Note: you can change the name of the text editor from gedit to the one your distro is using. Don’t know, open your text editor and click help and about to find the name.
Adding Custom Actions to Nemo File Manager
Nemo allows the user to add new entries to the context menu. The file /usr/share/nemo/actions/sample.nemo_action contains an example of a Nemo action. Directories to place custom action files:
/usr/share/nemo/actions/ for system-wide actions
$HOME/.local/share/nemo/actions/ for user actions
Pay attention to the name convention. Your file has to preserve the file ending .nemo_action.
Moving files Script
First lets open a text editor . Example: gedit (since where saving this in our home directory, no need to be root)
Now copy and paste this into the text editor
Comment=Archiving %N will add .archive to the object.
Now save the file to $Home /.local/share/nemo/actions/archive.nemo_action (archive.nemo_action is the filename, please note the .nemo_action must be at the end of the file name)
Now create the Archive executable program. While still in the text editor create a new doc, copy and paste the following into the text editor
#! /usr/bin/python2 -OOt
filename = sys.argv
print “Running ” + filename
print “With the following arguments:”
for arg in sys.argv:
if filename == arg:
#os.rename(‘%s’,’%s.archive’) % (arg,arg)
Now save the file to $HOME /.local/share/nemo/actions/archive.py (archive.py is the filename)
Adding custom actions to file manager for nemo is a little different then in XFCE. Nemo uses scripts to get the job done. You can though create a script to do about anything you need it to do.
If you have any questions please contact me and I will glad to try and help you.
Reference for Thunar actions: http://docs.xfce.org/xfce/thunar/custom-actions