Add OS X proxy icon to title bar

Fixes #1891.

Test Plan:

  * Opened Atom window in directory, verified directory icon shows up
  * Opened a file and verified icon changed
  * Right clicked icon, verified menu appears
  * Drag file to terminal and it pastes the file path (yay)
  * Opened a new Atom window and opened some files in that to make sure that
    it didn't change the original window

I didn't add any specs for this - advice welcome here. I also haven't tested
on Windows or Linux but it looks like `setRepresentedFilename` is a noop on
those platforms.
This commit is contained in:
Desmond Brand
2014-08-03 17:14:17 -07:00
parent de6ccd8c08
commit e1f4b7415a

View File

@@ -210,19 +210,23 @@ class WorkspaceView extends View
confirmClose: ->
@panes.confirmClose()
# Updates the application's title, based on whichever file is open.
# Updates the application's title and proxy icon based on whichever file is
# open.
updateTitle: ->
if projectPath = atom.project.getPath()
if item = @getModel().getActivePaneItem()
@setTitle("#{item.getTitle?() ? 'untitled'} - #{projectPath}")
title = "#{item.getTitle?() ? 'untitled'} - #{projectPath}"
path = item.getPath?() ? projectPath
@setTitle(title, path)
else
@setTitle(projectPath)
@setTitle(projectPath, projectPath)
else
@setTitle('untitled')
# Sets the application's title.
setTitle: (title) ->
# Sets the application's title (and the proxy icon on OS X)
setTitle: (title, path) ->
document.title = title
atom.getCurrentWindow().setRepresentedFilename(path ? '')
# Get all editor views.
#