mirror of
https://github.com/atom/atom.git
synced 2026-02-19 02:44:29 -05:00
Reuse existing windows when opening paths from command line
This commit is contained in:
@@ -2,14 +2,19 @@ $ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
ipc = require 'ipc'
|
||||
Subscriber = require 'subscriber'
|
||||
fsUtils = require 'fs-utils'
|
||||
|
||||
module.exports =
|
||||
class WindowEventHandler
|
||||
constructor: ->
|
||||
@subscribe ipc, 'command', (command) -> $(window).trigger command
|
||||
@subscribe ipc, 'command', (command, args...) ->
|
||||
$(window).trigger(command, args...)
|
||||
|
||||
@subscribe $(window), 'focus', -> $("body").removeClass('is-blurred')
|
||||
@subscribe $(window), 'blur', -> $("body").addClass('is-blurred')
|
||||
@subscribe $(window), 'window:open-path', (event, pathToOpen) ->
|
||||
rootView.open(pathToOpen) unless fsUtils.isDirectory(pathToOpen)
|
||||
|
||||
@subscribeToCommand $(window), 'window:toggle-full-screen', => atom.toggleFullScreen()
|
||||
@subscribeToCommand $(window), 'window:close', =>
|
||||
if rootView?
|
||||
@@ -30,6 +35,7 @@ class WindowEventHandler
|
||||
|
||||
@subscribe $(document), 'click', 'a', @openLink
|
||||
|
||||
|
||||
openLink: (event) =>
|
||||
location = $(event.target).attr('href')
|
||||
return unless location
|
||||
|
||||
Reference in New Issue
Block a user