How to add a new context menu item in Nautilus file manager

Question: I want to create a separate context menu in Nautilus, which launches an external program against a selected file. How can I add a new context menu in Nautilus file manager?

As a default file manager of the GNOME desktop, one of Nautilus' notable features is its extensible interface, where users can add arbitrary actions to its context menus by using scripts or configuration GUI. Nautilus-Actions is a Nautilus extension for configuring context menus via GUI.

This tutorial describes how to add a new context menu item in Nautilus file manager by using Nautilus-Actions configuration tool.

First, install Nautilus-Actions package:

$ sudo apt-get install nautilus-actions

Then launch Nautilus-Actions configuration tool by using command line or via Unity Dash as follows.

$ nautilus-actions-config-tool

Click on "Define New Action" button at the top left. Then under "Action" tab, fill in action info as shown below. In this example, I am going to define an action to launch a GUI program called pdfmod (whose built-in icon is available in /usr/share/icons).

Under "Command" tab, fill in command information, including a full path to the command (e.g., /usr/bin/pdfmod), and optional parameter(s). Click on "Legend" button to check available parameters to use.

Under "Execution" tab, choose execution mode. When an application needs to be run inside a terminal, choose "In a terminal". Otherwise, you can choose "Normal".

Save the newly created action, and quit the tool.

Finally, run the following command to reload Nautilus.

$ nautilus -q

Now launch Nautilus file manager. Choose a particular file, and right-click it. You should see the new context menu you just created, under "Nautilus Actions" menu.

If you still don't see the context menu, log out, and log back in. This will ensure the Nautilus configuration change takes effect.

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

4 thoughts on “How to add a new context menu item in Nautilus file manager

Leave a comment

Your email address will not be published. Required fields are marked *