@@ -61,39 +61,54 @@ define(function (require, exports, module) {
61
61
var _$titleWrapper = null ;
62
62
/** @type {string } Label shown above editor for current document: filename and potentially some of its path */
63
63
var _currentTitlePath = null ;
64
+ /** @type {string } String template for window title. Use emdash on mac only. */
65
+ var WINDOW_TITLE_STRING = ( brackets . platform !== "mac" ) ? "{0} - {1}" : "{0} \u2014 {1}" ;
64
66
65
67
/** @type {jQueryObject } Container for _$titleWrapper; if changing title changes this element's height, must kick editor to resize */
66
68
var _$titleContainerToolbar = null ;
67
69
/** @type {Number } Last known height of _$titleContainerToolbar */
68
70
var _lastToolbarHeight = null ;
69
71
70
72
function updateTitle ( ) {
71
- var currentDoc = DocumentManager . getCurrentDocument ( ) ;
72
- if ( currentDoc ) {
73
- _$title . text ( _currentTitlePath ) ;
74
- _$title . attr ( "title" , currentDoc . file . fullPath ) ;
75
- // dirty dot is always in DOM so layout doesn't change, and visibility is toggled
76
- _$dirtydot . css ( "visibility" , ( currentDoc . isDirty ) ? "visible" : "hidden" ) ;
77
- } else {
78
- _$title . text ( "" ) ;
79
- _$title . attr ( "title" , "" ) ;
80
- _$dirtydot . css ( "visibility" , "hidden" ) ;
81
- }
82
-
83
- // Set _$titleWrapper to a fixed width just large enough to accomodate _$title. This seems equivalent to what
84
- // the browser would do automatically, but the CSS trick we use for layout requires _$titleWrapper to have a
85
- // fixed width set on it (see the "#main-toolbar.toolbar" CSS rule for details).
86
- _$titleWrapper . css ( "width" , "" ) ;
87
- var newWidth = _$title . width ( ) ;
88
- _$titleWrapper . css ( "width" , newWidth ) ;
73
+ var currentDoc = DocumentManager . getCurrentDocument ( ) ,
74
+ windowTitle = brackets . config . app_title ;
75
+
76
+ if ( brackets . inBrowser ) {
77
+ if ( currentDoc ) {
78
+ _$title . text ( _currentTitlePath ) ;
79
+ _$title . attr ( "title" , currentDoc . file . fullPath ) ;
80
+ // dirty dot is always in DOM so layout doesn't change, and visibility is toggled
81
+ _$dirtydot . css ( "visibility" , ( currentDoc . isDirty ) ? "visible" : "hidden" ) ;
82
+ } else {
83
+ _$title . text ( "" ) ;
84
+ _$title . attr ( "title" , "" ) ;
85
+ _$dirtydot . css ( "visibility" , "hidden" ) ;
86
+ }
89
87
90
- // Changing the width of the title may cause the toolbar layout to change height, which needs to resize the
91
- // editor beneath it (toolbar changing height due to window resize is already caught by EditorManager).
92
- var newToolbarHeight = _$titleContainerToolbar . height ( ) ;
93
- if ( _lastToolbarHeight !== newToolbarHeight ) {
94
- _lastToolbarHeight = newToolbarHeight ;
95
- EditorManager . resizeEditor ( ) ;
88
+ // Set _$titleWrapper to a fixed width just large enough to accomodate _$title. This seems equivalent to what
89
+ // the browser would do automatically, but the CSS trick we use for layout requires _$titleWrapper to have a
90
+ // fixed width set on it (see the "#main-toolbar.toolbar" CSS rule for details).
91
+ _$titleWrapper . css ( "width" , "" ) ;
92
+ var newWidth = _$title . width ( ) ;
93
+ _$titleWrapper . css ( "width" , newWidth ) ;
94
+
95
+ // Changing the width of the title may cause the toolbar layout to change height, which needs to resize the
96
+ // editor beneath it (toolbar changing height due to window resize is already caught by EditorManager).
97
+ var newToolbarHeight = _$titleContainerToolbar . height ( ) ;
98
+ if ( _lastToolbarHeight !== newToolbarHeight ) {
99
+ _lastToolbarHeight = newToolbarHeight ;
100
+ EditorManager . resizeEditor ( ) ;
101
+ }
96
102
}
103
+
104
+ // build shell/browser window title, e.g. "• file.html — Brackets"
105
+ if ( currentDoc ) {
106
+ windowTitle = StringUtils . format ( WINDOW_TITLE_STRING , _currentTitlePath , windowTitle ) ;
107
+ windowTitle = ( currentDoc . isDirty ) ? "• " + windowTitle : windowTitle ;
108
+ }
109
+
110
+ // update shell/browser window title
111
+ window . document . title = windowTitle ;
97
112
}
98
113
99
114
function updateDocumentTitle ( ) {
@@ -722,7 +737,7 @@ define(function (require, exports, module) {
722
737
}
723
738
} ) ;
724
739
}
725
-
740
+
726
741
/**
727
742
* @private
728
743
* Implementation for abortQuit callback to reset quit sequence settings
0 commit comments