Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8240787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:36:38+00:00 2026-06-07T20:36:38+00:00

I’ve an application written using PyGTK (GTK+2). I’d like to integrate it with Nautilus

  • 0

I’ve an application written using PyGTK (GTK+2). I’d like to integrate it with Nautilus via an extension (something I am trying to learn). My current desktop has GNOME3 and Nautilus 3, which is written in GTK+3 and the extensions for Nautilus uses PyGObject.

Can I integrate my application in GTK+2 with Nautilus 3? (without porting my application to GTK+3, yet). Any hint?

I’m planning to port my application to GTK+3 (PyGObject), but it’ll require more time than I have now.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T20:36:40+00:00Added an answer on June 7, 2026 at 8:36 pm

    Yes, it is possible. For instance, you can use Nautilus to call your program with the files or directories as arguments. The program you are calling can be written with any toolkit, or even be just a shell script.

    A tiny example or an extension:

    from gi.repository import Nautilus, GObject
    from urllib import unquote
    
    PROGRAM_NAME = '/path/to/your/program'
    
    class MyExtension(GObject.GObject, Nautilus.MenuProvider):
        def __init__(self):
            pass
    
        def call_my_program(self, menu, files):
            # Do whatever you want to do with the files selected
            if len(files) == 0:
                return
    
            # Strip the URI format to plain file names
            names = [ unquote(file.get_uri()[7:]) for file in files ]
    
            argv = [ PROGRAM_NAME ] + names
    
            GObject.spawn_async(argv, flags=GObject.SPAWN_SEARCH_PATH)
    
        def get_file_items(self, window, files):
            # Show the menu if there is at least on file selected
            if len(files) == 0:
                return
    
            # We care only files (local files)            
            for fd in files:
                if fd.is_directory() or fd.get_uri_scheme() != 'file':
                    return
    
            item = Nautilus.MenuItem(name='MyExtensionID::MyMethodID',
                                     label='Do something with my program...')
            item.connect('activate', self.call_my_program, files)
    
            return item,
    

    The extension is written using GObject Introspection (Nautilus 3), and it is generic: you can call any external program you want that accepts files as arguments. The key is GObject.spawn_async().

    get_file_items is the method that Nautilus call when the user interacts with files. In that, you can bind a contextual menu (with Nautilus.MenuItem()). Then, you connect that menu with the method that calls your program (call_my_program()).

    You can create other filters in the method get_file_items. For instance, to show the contextual menu only if there are text plain files selected (using fd.is_mime_type()). You can do whatever you have in mind. Beware of performing only non-blocking operations, otherwise you could block Nautilus.

    To test the extension, you can install it in ~/.local/share/nautilus-python/extensions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.