Howto Add Items to the Right-Click Menu in Nautilus

Mon, Mar 2, 2009

Tweet this!


Linux is known for letting users configure settings to customize nearly every aspect of their desktops. In the past, this has largely been relegated to the more advanced crowd, since it often required editing text-based configuration files; but as Linux becomes more mature, many GUI programs are being written to allow easy customization of the user interface. The Nautilus Actions Configuration utility is one such program that lets you add custom commands to the right-click menu in Nautilus, the default file manager in Gnome.


Ubuntu users can install the Nautilus Actions Configuration utility via the software repositories using the command:

sudo apt-get install nautilus-actions

Users of other distributions should check their package manager for the program, or you can visit the Nautilus-Actions project page for more downloads, including source files.

Adding a new Item

Once installed, you’ll find a new entry in your System menu, under “Preferences” titled “Nautilus Actions Configuration.” Opening it will give you this window:

Nautilus Actions Main Window

To add a new menu option, click the “Add” button. For this example, I will be adding an option to enqueue audio files into my favorite MP3 player, Audacious; but you can add an option for anything you like using the same basic steps.

Menu Item & Action

This window is where you will specify the command to be run, and what you want the listing in the menu to be called.

Nautilus Actions Add Item Main Window

There are five fields here:

Field Use
Label This is the text that will appear in the right-click menu. Here I’ve chosen, “Add to Playlist”
Tooltip This text will appear in the status bar in your Nautilus window. You should enter some brief text that explains what clicking the function will do; in my case, I have set it as “Enqueue in Audacious Playlist.”
Icon The icon you want to appear next to the “Label” in the right-click menu. Clicking on the Browse button will take you to the pixmaps folder, which is where most system icons are kept. I have selected the Audacious application icon.
Path Here, specify the location of the program you want to call when the menu item is clicked. Since I am using Audacious, I ran the command which audacious in a terminal, which tells me that the audacious program is located at /usr/bin/audacious.
Parameters Here, specify the command-line options to use when calling the application. To find out the available commands for your application, open a terminal and run [command] –help or, for a more detailed listing, use man [command]. In my case, I found that the “-e” flag is used to enqueue a file in the playlist, so I am using “-e” as my parameter.

Next, click on the “Legend” button. You’ll see a window that shows you all the available options you can append to the parameter field:

Nautilus Actions Configuration Legend

In this case, since I want to be able to enqueue multiple files, my complete Parameters field is: -e %d%M which means “enqueue the multiple files I’ve selected into the playlist.

Right below the “Parameters” field, you’ll see an example output of what will be run when you click on the command in the right-click menu. You can test it out in a terminal, to make sure that it will do exactly what you want it to do; if it isn’t successful, go back and repeat the steps for the “Parameter” field until you get things right.

The Conditions tab allows you to set which types of files will include the new menu item when you right-click on them. Since, in my case, I want to be able to enqueue audio files, I’ve set the “Filenames” field to contain common audio files (mp3, flac, m4a, etc) seperated with a semicolon. I’ve also decided to use the “Mimetypes” field to include any audio file.

Setting Conditions in Nautilus Action Manager

To find out the mimetype of a certain type of file, right click on an example file (in my case, I used an mp3) and click on the “Properties” option. You will see a field marked “MIME type” that shows you how the system reads that particular kind of file. Audio files, for example, will be listed as “audio/[codec]” and since I want my new menu entry to work for all audio files, I use “audio/*” as my Mimetype option. “*” is a wildcard; it means “match anything that goes here,” so it will include all codecs.

Advanced Conditions
The “Advanced Conditions” tab is something most users may not need to adjust; it deals with how the file is being accessed through Nautilus. Since Nautilus has the ability to read files over Samba, FTP, Secure FTP (SSH), and Webdav, you can limit which different with which protocols you want your menu item to apply.

In my particular case, I’ve enabled SMB, FTP, and SFTP, since I am using these different protocols to access various machines on my network. If you don’t know what these are, or you’re not using them, it’s safe to either leave just the “Local Files” option checked, or to check them all.

The result

Once I saved my new menu item, I immediately wanted to try it out! So I navigated to a folder of some music I’ve ripped from my personal CD collection, and right-clicked on some mp3 files. Sure enough, my context menu had a new option:

New Right Click Menu Option in Nautilus

Clicking on this option did just what I expected; Audacious kept playing the file that was already being played, and all the new files I’d selected were added to the playlist. Neat, huh?


Another nice feature of the Nautilus-Actions utliity is that you can export and import configurations; this is great if you want to back-up your changes, or if you have multiple machines that you want to customize. You can select which menu items you want to export and save them to a file, and then transfer them to another computer, and use the import function to instantly add them to the right-click contextual menu. While this might not be particularly useful if you’re only using a single workstation, businesses and large networks will find that this saves quite a bit of time for customization.


The Nautilus-Actions-Configuration utility is a simple, easy-to-use program that makes it a snap for even the most inexperienced user to add custom items to a Gnome menu. Unfortunately, it only works in Nautilus, but I’m sure there are other programs available for Thunar (XFCE4’s primary file manager) and for KDE. If you’ve ever wanted to add extra menus options, but you just didn’t know how, this is one program that will become a must-have on your desktop.

Like this post?

13 Responses to “Howto Add Items to the Right-Click Menu in Nautilus”

  1. Thomas says:

    Great how-to, Jonathan. Do you know of any requirements for the icons to be added to the context menu? I have added a 16×16 png icon which does not show in the context menu, though. Weirdly enough, it does show in the Nautilus Action list, however. Any help is greatly appreciated.

  2. Evan says:

    Great tutorial – thanks. I was looking just this type of thing to leverage imagemagick conversions from within the right click menu. Awesome! I am having the same problem as the previous poster in regards to icons, however. I tried several different icon formats, but nothing seems to show in the right-click menu.

  3. helios says:

    Jonathan, do you have, or is there a list anywhere that will show people the different things that can be added? I know for a fact that there are things that I want to do with this but right off the top of my head, I can’t think of any. Maybe a list of options/items would help folks mentally challenged like me make good use of this great tool.

  4. Andrey says:

    I use Ubuntu 8.10.
    I discovered that Action/Parameters string should be different than one in the article. For me correct string is like this: -e %M.
    Anyway thanks for the article.

  5. David says:

    I just finished writing a nautilus script that allows a user to right click on pdf documents and print them… Now I can make it even better!

  6. Geert says:

    Using Ubuntu 9.10 (Gnome desktop), I tried the above method to have an item to open a terminal when right-clicking in Nautilus on a folder.
    The command to be used is /usr/bin/gnome-terminal. I added no parameter, since I only want this item to appear in the context menu when I right-click in Nautilus, the moment a directory is selected.
    Hence, in the tab “Conditions” I selected the “Only folders” option for the section “Appears if selection contains”.
    The rest of all the options/items is left untouched.
    However, after closing the Nautilus Actions Configuration and also restarting the Nautilus browser, I can’t see the newly created menu in the right-click context menu, when I first select a directory.
    Any ideas?

  7. Mike says:

    This just doesn’t work in the latest version (2.30). I’ve reported the bug. Currently this product is totally unusable.

    User errors aren’t currently reported to the user, aside from the occasional lame idea of marking an item red. Users need to know what is wrong before they can fix it… this is extremely basic design principles here, so I’m not impressed!!!

  8. @David, Can you post the set up for printing *.pdf files? That is exactly what I was looking for when I found this page.


  9. WPareene says:

    I want to take items away from the right click. Where are the standard commands located so they may be removed?

  10. jason says:

    I am running 2.3.2, and I found that by removing the spaces in the filenames list I can get a command to appear in the right click menu. Example. change ( *.html ; *.txt ), or whatever you have to (*.html;*.txt). I also removed the match case requirement. Still no image, even though I selected one. Also, when the menu option shows in the right click list, it removed the shortcut from the nautilus window toolbar.


  1. Cómo añadir elementos al menú contextual de Nautilus | Lagg3r's - 13. Sep, 2010

    […] | TechThrob […]

Leave a Reply

Weekly Poll

What's the best Linux distribution for desktops?

View Results

Loading ... Loading ...

Related Posts

Search TechThrob