diff --git a/keymaps/linux.cson b/keymaps/linux.cson index 2cb431e7f..7126fd4ed 100644 --- a/keymaps/linux.cson +++ b/keymaps/linux.cson @@ -16,7 +16,7 @@ # Sublime Parity 'ctrl-N': 'application:new-window' 'ctrl-W': 'window:close' - 'ctrl-o': 'application:open' + 'ctrl-o': 'application:open-file' 'ctrl-q': 'application:quit' 'ctrl-T': 'pane:reopen-closed-item' 'ctrl-n': 'application:new-file' diff --git a/keymaps/win32.cson b/keymaps/win32.cson index b9a3364da..9c51ac5ba 100644 --- a/keymaps/win32.cson +++ b/keymaps/win32.cson @@ -14,7 +14,7 @@ # Sublime Parity 'ctrl-N': 'application:new-window' 'ctrl-W': 'window:close' - 'ctrl-o': 'application:open' + 'ctrl-o': 'application:open-file' 'ctrl-T': 'pane:reopen-closed-item' 'ctrl-n': 'application:new-file' 'ctrl-s': 'core:save' diff --git a/menus/linux.cson b/menus/linux.cson index 2b5658112..8ffb657d4 100644 --- a/menus/linux.cson +++ b/menus/linux.cson @@ -4,7 +4,8 @@ submenu: [ { label: 'New &Window', command: 'application:new-window' } { label: '&New File', command: 'application:new-file' } - { label: '&Open...', command: 'application:open' } + { label: '&Open File...', command: 'application:open-file' } + { label: 'Open Folder...', command: 'application:open-folder' } { label: 'Reopen Last &Item', command: 'pane:reopen-closed-item' } { type: 'separator' } { label: '&Preferences...', command: 'application:show-settings' } diff --git a/menus/win32.cson b/menus/win32.cson index f69ab563c..ad52c6e71 100644 --- a/menus/win32.cson +++ b/menus/win32.cson @@ -4,7 +4,8 @@ submenu: [ { label: 'New &Window', command: 'application:new-window' } { label: '&New File', command: 'application:new-file' } - { label: '&Open...', command: 'application:open' } + { label: '&Open File...', command: 'application:open-file' } + { label: 'Open Folder...', command: 'application:open-folder' } { label: 'Reopen Last &Item', command: 'pane:reopen-closed-item' } { type: 'separator' } { label: '&Preferences...', command: 'application:show-settings' } diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 5061b7fc6..c275e4e70 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -135,7 +135,9 @@ class AtomApplication @on 'application:quit', -> app.quit() @on 'application:new-window', -> @openPath(windowDimensions: @focusedWindow()?.getDimensions()) @on 'application:new-file', -> (@focusedWindow() ? this).openPath() - @on 'application:open', -> @promptForPath() + @on 'application:open', -> @promptForPath(type: 'all') + @on 'application:open-file', -> @promptForPath(type: 'file') + @on 'application:open-folder', -> @promptForPath(type: 'folder') @on 'application:open-dev', -> @promptForPath(devMode: true) @on 'application:inspect', ({x,y}) -> @focusedWindow().browserWindow.inspectElement(x, y) @on 'application:open-documentation', -> shell.openExternal('https://atom.io/docs/latest/?app') @@ -407,9 +409,19 @@ class AtomApplication # Once paths are selected, they're opened in a new or existing {AtomWindow}s. # # * options + # + type: + # A String which specifies the type of the dialog, could be 'file', + # 'folder' or 'all'. The 'all' is only available on OS X. # + devMode: # A Boolean which controls whether any newly opened windows should be in # dev mode or not. - promptForPath: ({devMode}={}) -> - dialog.showOpenDialog title: 'Open', properties: ['openFile', 'openDirectory', 'multiSelections', 'createDirectory'], (pathsToOpen) => + promptForPath: ({type, devMode}={}) -> + type ?= 'all' + properties = + switch type + when 'file' then ['openFile'] + when 'folder' then ['openDirectory'] + when 'all' then ['openFile', 'openDirectory'] + else throw new Error("#{type} is an invalid type for promptForPath") + dialog.showOpenDialog title: 'Open', properties: properties.concat(['multiSelections', 'createDirectory']), (pathsToOpen) => @openPaths({pathsToOpen, devMode}) diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index 9e46f26f8..52803a8ef 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -116,6 +116,8 @@ class WorkspaceView extends View @command 'application:new-window', -> ipc.sendChannel('command', 'application:new-window') @command 'application:new-file', -> ipc.sendChannel('command', 'application:new-file') @command 'application:open', -> ipc.sendChannel('command', 'application:open') + @command 'application:open-file', -> ipc.sendChannel('command', 'application:open-file') + @command 'application:open-folder', -> ipc.sendChannel('command', 'application:open-folder') @command 'application:open-dev', -> ipc.sendChannel('command', 'application:open-dev') @command 'application:minimize', -> ipc.sendChannel('command', 'application:minimize') @command 'application:zoom', -> ipc.sendChannel('command', 'application:zoom')