From e1f4b7415acc3ad5a252b4e83c1f37ea5926585d Mon Sep 17 00:00:00 2001 From: Desmond Brand Date: Sun, 3 Aug 2014 17:14:17 -0700 Subject: [PATCH] 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. --- src/workspace-view.coffee | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index 4206e9f83..e1b8a81ae 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -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. #