mirror of
https://github.com/atom/atom.git
synced 2026-02-17 01:51:54 -05:00
Use the right project path for document title
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user