"New file" or "New window" option in OS X Dock application context menu


In a number of text editors that I have used on my Mac, if you open the application dock icon context menu, one of the options in the menu is create a new file or a new window. It would be great if Atom also had this capability as I use it a fair bit.

Justification / Process
This would be a very useful when using multiple desktops (Spaces in Mac parlance) and you want to open a new Atom window in a desktop that doesn’t have any Atom windows. As of v0.129.0, the (or at least my) current process is:

  1. switch back to the desktop that has Atom open,
  2. create a new Atom window, and
  3. move the new window to the required desktop.

New process
The new process I would like to use is:

  1. open dock application context menu and choose new window/new file.


I want this pretty much daily, too. https://github.com/atom/atom-shell/blob/master/docs/tutorial/desktop-environment-integration.md suggests that writing such an extension should be possible, but I’m not sure I have the requisite time to do so. If anyone’s aware of a package being written already to do this, please let me know!


This is sort of related to #4241 and #3935 if you want to track those too. But I definitely agree, this would be an awesome addition to core.


Thanks for those links. I took a look at using the desktop-environment-integration in a package last night, but the two packages that the tutorial says to require (app and menu) didn’t seem to exist. Am I being dense, or are these not exposed to the user’s Atom packages?
(Sorry, I’m rather inexperienced with Atom development)


The document you linked to is an Atom Shell document. Atom Shell is the component that handles working with the OS, starting up IO.js, creating the browser window and such. It’s components are available within Atom, but not commonly accessible to or used by Atom packages. If you want to make changes there, it is probably best to work on the atom-shell project itself.


Thanks. I don’t think I need changes to atom-shell itself, but to whichever part of Atom exposes things to the packages, such that it can also expose the dock menu for modification. Does that sound about right?


In general, Atom Shell is the part of Atom that has access to the OS-specific stuff. So if you want something exposed to packages from the OS, Atom Shell would be the place to do it.

Unless you write an npm module to go directly to the OS by itself.

Also, here’s a post I made about the architecture of Atom Shell and how the native parts (like the Dock) and the UI parts (like Atom packages) are separated into two distinct processes:


Ah, that’s useful, thanks. I’ll try to look at this when I have some cycles. It’s enough of an irritation to try to get my hands dirty.


I already commented in GitHub issue #5921, but as this thread comes up first in Google search, I’ll add my two cents here too.

While Atom does not support this natively, I’ve written a small AppleScript that you can use in conjunction with Spotlight/Alfred to quickly open new Atom window in current space/desktop.

Find it in my blog: http://blog.laaz.org/tech/2015/09/22/atom-new-window-via-applescript/

Hope this helps.


There are ways to do this natively. https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/OtherMenus.html#//apple_ref/doc/uid/20000957-CH31-SW1



The bug mentioned above is closed. This is fixed in the latest Stable version of Atom.