diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index b1b475c50..13ab2e7f8 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -140,14 +140,18 @@ class AtomApplication # Registers basic application commands, non-idempotent. handleEvents: -> + getLoadSettings = => + devMode: @focusedWindow()?.devMode + safeMode: @focusedWindow()?.safeMode + @on 'application:run-all-specs', -> @runSpecs(exitWhenDone: false, resourcePath: global.devResourcePath, safeMode: @focusedWindow()?.safeMode) @on 'application:run-benchmarks', -> @runBenchmarks() @on 'application:quit', -> app.quit() - @on 'application:new-window', -> @openPath(windowDimensions: @focusedWindow()?.getDimensions()) + @on 'application:new-window', -> @openPath(_.extend(windowDimensions: @focusedWindow()?.getDimensions(), getLoadSettings())) @on 'application:new-file', -> (@focusedWindow() ? this).openPath() - @on 'application:open', (loadSettings) -> @promptForPath(_.extend(type: 'all', loadSettings)) - @on 'application:open-file', (loadSettings) -> @promptForPath(_.extend(type: 'file', loadSettings)) - @on 'application:open-folder', (loadSettings) -> @promptForPath(_.extend(type: 'folder', loadSettings)) + @on 'application:open', -> @promptForPath(_.extend(type: 'all', getLoadSettings())) + @on 'application:open-file', -> @promptForPath(_.extend(type: 'file', getLoadSettings())) + @on 'application:open-folder', -> @promptForPath(_.extend(type: 'folder', getLoadSettings())) @on 'application:open-dev', -> @promptForPath(devMode: true) @on 'application:open-safe', -> @promptForPath(safeMode: true) @on 'application:inspect', ({x,y, atomWindow}) -> @@ -227,8 +231,8 @@ class AtomApplication ipc.on 'run-package-specs', (event, specDirectory) => @runSpecs({resourcePath: global.devResourcePath, specDirectory: specDirectory, exitWhenDone: false}) - ipc.on 'command', (event, command, options) => - @emit(command, options) + ipc.on 'command', (event, command) => + @emit(command) ipc.on 'window-command', (event, command, args...) -> win = BrowserWindow.fromWebContents(event.sender) diff --git a/src/browser/atom-window.coffee b/src/browser/atom-window.coffee index b70ff0481..6448d1cca 100644 --- a/src/browser/atom-window.coffee +++ b/src/browser/atom-window.coffee @@ -18,7 +18,7 @@ class AtomWindow isSpec: null constructor: (settings={}) -> - {@resourcePath, pathToOpen, initialLine, initialColumn, @isSpec, @exitWhenDone, @safeMode} = settings + {@resourcePath, pathToOpen, initialLine, initialColumn, @isSpec, @exitWhenDone, @safeMode, @devMode} = settings # Normalize to make sure drive letter case is consistent on Windows @resourcePath = path.normalize(@resourcePath) if @resourcePath diff --git a/src/workspace-element.coffee b/src/workspace-element.coffee index b01c566ff..425d920d8 100644 --- a/src/workspace-element.coffee +++ b/src/workspace-element.coffee @@ -131,9 +131,9 @@ atom.commands.add 'atom-workspace', 'application:unhide-all-applications': -> ipc.send('command', 'application:unhide-all-applications') 'application:new-window': -> ipc.send('command', 'application:new-window') 'application:new-file': -> ipc.send('command', 'application:new-file') - 'application:open': -> ipc.send('command', 'application:open', devMode: atom.inDevMode(), safeMode: atom.inSafeMode()) - 'application:open-file': -> ipc.send('command', 'application:open-file', devMode: atom.inDevMode(), safeMode: atom.inSafeMode()) - 'application:open-folder': -> ipc.send('command', 'application:open-folder', devMode: atom.inDevMode(), safeMode: atom.inSafeMode()) + 'application:open': -> ipc.send('command', 'application:open') + 'application:open-file': -> ipc.send('command', 'application:open-file') + 'application:open-folder': -> ipc.send('command', 'application:open-folder') 'application:open-dev': -> ipc.send('command', 'application:open-dev') 'application:open-safe': -> ipc.send('command', 'application:open-safe') 'application:minimize': -> ipc.send('command', 'application:minimize')