No "Open With Atom" context menu entry with Nautilus


#1

Similar to

However in my case it did not “disappear”. There is and was just never such a context menu entry as “Open With Atom”.
For files this is not a problem (and is rather a good thing) as I can select “Open With” --> “Atom” there anyway, but for folders it would really be convenient to have this menu entry.

Nautilus 3.14.1-2
Atom 1.11.2 (but happened with previous versions too)
Debian Jessie


#2

I’ll try to add one manually as described here, but still this is more of a workaround.

Also the same question is asked here:

However I don’t see this “Open With” menu on folders.


#3


#4

No actually this menu is not there. It is only shown for files.


#5

I’m running Ubuntu 16.10 with Gnome 3.20.4, and I’ve configured my Gnome Files (nee Nautilus) to allow me to open Atom in the current folder (right click on an empty space in the current folder). I used the Nautilus-Actions Configuration Tool (nautilus-actions package), but I suspect you can edit the Nautilus config file directly. Here’s the config I’m using in the gui tool:


#6

Yes, I also saw it works like this, but native support would be preferable.


#7

change “atom.desktop” (locations: “/usr/share/applications/atom.desktop” and “~/.local/share/applications/atom.desktop”)

#sudo nano /usr/share/applications/atom.desktop

in:
MimeType=text/plain;
change for:
MimeType=text/plain;inode/directory;

after save
#sudo update-desktop-database (command for build a cache database of the MIME types handled by desktop files)

my atom.desktop and script for update menus in: http://askubuntu.com/a/862120/494219


#8

The link “http://askubuntu.com/a/862120/494219” has been deleted, the fix has been proposed in the atom’s official github!


#9

Can you give me a link?

I think the change in the Atom.desktop file could/should be included in the official *.deb files.


#10

#11

EDIT: more information here: http://bit.ly/AtomContextMenuInstallation

There is an alternative that I prefer, by adding an entry in the Nautilus context menu. Please note that python-nautilus must be installed to work. Write a scritp nautilus-plugin-atom.py in .local/share/nautilus-python/extensions (create the directory if it does not exist already) with the following code:

import os

from gi.repository import Nautilus, GObject

class AtomOpenDirectory(GObject.GObject, Nautilus.MenuProvider):
    def __init__(self):
        pass

    def menu_activate_cb(self, menu, file):
        try:
            path = file.get_location().get_path()
            os.system("atom %s & pid=&!" % path)
        except AttributeError: # it is a list of elements
            dir_list = [f.get_location().get_path() for f in file if f.is_directory()]
            os.system("atom %s & pid=&!" % ' '.join(dir_list))

    def define_menu_helper(self, name, window, file):
        item = Nautilus.MenuItem(name="AtomOpenDirectory::" + name,
                                 label="Open directories in Atom",
                                 tip='', icon='')
        item.connect('activate', self.menu_activate_cb, file)
        return item,

    def get_background_items(self, window, file):
        return self.define_menu_helper("Background", window, file)

    def get_file_items(self, window, file):
        return self.define_menu_helper("File", window, file)

and reload nautilus (killall nautilus). The context menu should appear when you click on the background of a directory and on a list of selected files. From the list, only directories will be opened (added as project dirs).


#12

At least on folders the menu entry is shown, but it does not open Atom when I click on it.


#13

Is atom in your PATH?


#14

There is a mistype in the code. Please refer to the one in the link at the top of the post: http://bit.ly/AtomContextMenuInstallation

I’ll correct my previous post.

EDIT: now it is correct.