Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to change the menu items present in the Nautilus File Manager. I am open to getting my hands dirty in Python or anything else for that matter. I would like add or remove menu items from the context menu in Nautilus. Any help regarding this will be very helpful.


  1. I am not looking to going to any other file manager for this reason.
  2. I am not talking about Nautilus scripts either. I would like to know how the menu item called 'Scripts' was created in the first place.
share|improve this question
up vote 2 down vote accepted

To add menu items to can write a Nautilus extension, like

from gi.repository import Nautilus, GObject

class MyItemExtension(GObject.GObject, Nautilus.MenuProvider):
    def get_file_items(self, window, files):
        menuitem = Nautilus.MenuItem(name='MyItem::SomeItem', 
                                     label='My Item', 
                                     tip='my own item',

        menuitem.connect('activate', self.on_menu_item_clicked, files)
        return menuitem,

    def on_menu_item_clicked(self, item, files):
        print [f.get_name() for f in files]

Save this into something like /usr/share/nautilus-python/extensions/, install the package python-nautilus and restart Nautilus, for example by running nautilus -q; sleep 2; nautilus. Now you should see a new item "My Item" if you rightclick a file.

As far as I know there is no documented way to remove menu items.

The see API reference for some more information.

share|improve this answer

This applies only for Nautilus 3.8 and newer.

I know it is not the only place to do it, but you can add context options in the library : /usr/lib/nautilus/extensions-3.0.

The library files need to be .so hexadecimal libraries.

I think the other way to do it would be to modify the source code of Nautilus.

share|improve this answer
indeed this was really helpful to clean up the right-click menu on nautilus. Thanks! :) – Rho Mar 12 '15 at 20:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.