diff --git a/src/workspace.coffee b/src/workspace.coffee index f30d7534e..49f84f9b8 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -159,16 +159,24 @@ class Workspace extends Model # open. updateWindowTitle: => appName = 'Atom' - if projectPath = atom.project?.getPaths()[0] - if item = @getActivePaneItem() - document.title = "#{item.getTitle?() ? 'untitled'} - #{projectPath} - #{appName}" - atom.setRepresentedFilename(item.getPath?() ? projectPath) - else - document.title = "#{projectPath} - #{appName}" - atom.setRepresentedFilename(projectPath) + projectPaths = atom.project?.getPaths() ? [] + if item = @getActivePaneItem() + itemPath = item.getPath?() + itemTitle = item.getTitle?() + projectPath = _.find projectPaths, (projectPath) -> + itemPath is projectPath or itemPath?.startsWith(projectPath + path.sep) + itemTitle ?= "untitled" + projectPath ?= projectPaths[0] + + if item? and projectPath? + document.title = "#{itemTitle} - #{projectPath} - #{appName}" + atom.setRepresentedFilename(itemPath ? projectPath) + else if projectPath? + document.title = "#{projectPath} - #{appName}" + atom.setRepresentedFilename(projectPath) else - document.title = "untitled - #{appName}" - atom.setRepresentedFilename('') + document.title = "#{itemTitle} - #{appName}" + atom.setRepresentedFilename("") # On OS X, fades the application window's proxy icon when the current file # has been modified.