Custom context menu without creating a package


#1

I installed the atom-terminal package and I would like to add a command to the context menu in the tree view. I tried to add a new content menu entry into my config.cson, but it didn’t work.

'context-menu':
  '.platform-win32 .tree-view.full-menu':
    'Open Terminal Here': 'atom-terminal:open-project-root'

Does this not work without creating/updating a package? I would customize the atom-terminal package locally, but I can’t even find those files to edit.


Contextual Menu Modification?
#2

Atom packages get installed into ~/.atom/packages, so you should be able to find the atom-terminal directory inside there.


#3

Sorry, I should have mentioned that I am using Windows. So my atom is located in:

C:\ProgramData\chocolatey\lib\Atom.0.129.1

And I can’t find any packages in any of the sub-folders.

Update: Nevermind, I found the packages folder in Users{name}.atom

Thanks!


#4

If you click on a package name in the left column of the settings screen, you will see a button Open in Atom appear on the right. That does exactly what you want.

I hack local copies of packages all the time but of course changes are lost when the package is upgraded.


#5

So it is possible to create context menu without package? I was able to do it in init.coffee are there other ways?


#6

This is what I put in my init.coffee to snazzify my menu:

# https://atom.io/docs/api/v0.204.0/ContextMenuManager#instance-add
atom.contextMenu.add {
    'atom-text-editor': [
        { type: 'separator' },
        { label: 'Services', submenu: [] } #OSX
    ],
    'atom-workspace': [
        { label: 'Open+', command: 'open-plus:open' }
    ]
}

#7

how does one change the context menu for tree-view?

is there a key like ‘atom-workspace’ except for tree view?

also what to put in command to execute an os program, Like terminator in linux

this doesn’t work.

atom.contextMenu.add {
  'tree-view': [{label: 'Terminator', command: 'application:terminator'}]
}

#8

.tree-view. It’s a class, not an element.

also what to put in command to execute an os program, Like terminator in linux

You need the process-palette package for that.


#9

ok @DamnedScholar got my process palette command.

what is the syntax for the adding a menu entry for say their echo example? They only show adding to shortcut keys.

This below doesn’t work although the menu entry is now there so half working.

atom.contextMenu.add {
’.tree-view’: [{label: ‘echo’, command: ‘process-palette:echo’}]
}

btw process-palette:echo brings up the command in the command palette so scratching my head here.


#10

Can you screenshot your view of the Process Palette settings for that command?


#11

says Echo Example

so I tried ‘.tree-view’: [{label: ‘echo’, command: ‘process-palette:echo-example’}]

still no love. other thoughts?

Where does one find the code entries for the command pallette so I can see the actual command for the entry in the png.


#12

The command palette uses a simple transformation (that’s easily reversible if people follow the conventions) to generate the entries for the palette. See my comment here:


#13

To get to the settings for a specific package, go to Settings -> Packages and click on the ⚙ Settings button.