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

Last updated on June 19, 2020 by Dan Nanni

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 on Ubuntu desktop?

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.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean