Merge branch 'master' into as-ns-startup-snapshot

This commit is contained in:
Antonio Scandurra
2017-02-23 13:19:25 +01:00
7 changed files with 100 additions and 25 deletions

View File

@@ -694,8 +694,14 @@ class AtomEnvironment extends Model
@deserialize(state) if state?
@deserializeTimings.atom = Date.now() - startTime
if process.platform is 'darwin' and @config.get('core.useCustomTitleBar')
if process.platform is 'darwin' and @config.get('core.titleBar') is 'custom'
@workspace.addHeaderPanel({item: new TitleBar({@workspace, @themes, @applicationDelegate})})
@document.body.classList.add('custom-title-bar')
if process.platform is 'darwin' and @config.get('core.titleBar') is 'custom-inset'
@workspace.addHeaderPanel({item: new TitleBar({@workspace, @themes, @applicationDelegate})})
@document.body.classList.add('custom-inset-title-bar')
if process.platform is 'darwin' and @config.get('core.titleBar') is 'hidden'
@document.body.classList.add('hidden-title-bar')
@document.body.appendChild(@views.getView(@workspace))
@backgroundStylesheet?.remove()

View File

@@ -498,10 +498,11 @@ if (['win32', 'linux'].includes(process.platform)) {
}
if (process.platform === 'darwin') {
configSchema.core.properties.useCustomTitleBar = {
type: 'boolean',
default: false,
description: 'Use custom, theme-aware title bar.<br>Note: This currently does not include a proxy icon.<br>This setting will require a relaunch of Atom to take effect.'
configSchema.core.properties.titleBar = {
type: 'string',
default: 'native',
enum: ['native', 'custom', 'custom-inset', 'hidden'],
description: 'Experimental: A `custom` title bar adapts to theme colors. Choosing `custom-inset` adds a bit more padding. The title bar can also be completely `hidden`.<br>Note: Switching to a custom or hidden title bar will compromise some functionality.<br>This setting will require a relaunch of Atom to take effect.'
}
}

View File

@@ -84,7 +84,13 @@ class AtomApplication
initialize: (options) ->
global.atomApplication = this
@config.onDidChange 'core.useCustomTitleBar', @promptForRestart.bind(this)
# DEPRECATED: This can be removed at some point (added in 1.13)
# It converts `useCustomTitleBar: true` to `titleBar: "custom"`
if process.platform is 'darwin' and @config.get('core.useCustomTitleBar')
@config.unset('core.useCustomTitleBar')
@config.set('core.titleBar', 'custom')
@config.onDidChange 'core.titleBar', @promptForRestart.bind(this)
@autoUpdateManager = new AutoUpdateManager(
@version, options.test or options.benchmark or options.benchmarkTest, @resourcePath, @config

View File

@@ -43,9 +43,15 @@ class AtomWindow
if process.platform is 'linux'
options.icon = @constructor.iconPath
if @shouldHideTitleBar()
if @shouldAddCustomTitleBar()
options.titleBarStyle = 'hidden'
if @shouldAddCustomInsetTitleBar()
options.titleBarStyle = 'hidden-inset'
if @shouldHideTitleBar()
options.frame = false
@browserWindow = new BrowserWindow(options)
@handleEvents()
@@ -226,10 +232,20 @@ class AtomWindow
[width, height] = @browserWindow.getSize()
{x, y, width, height}
shouldAddCustomTitleBar: ->
not @isSpec and
process.platform is 'darwin' and
@atomApplication.config.get('core.titleBar') is 'custom'
shouldAddCustomInsetTitleBar: ->
not @isSpec and
process.platform is 'darwin' and
@atomApplication.config.get('core.titleBar') is 'custom-inset'
shouldHideTitleBar: ->
not @isSpec and
process.platform is 'darwin' and
@atomApplication.config.get('core.useCustomTitleBar')
@atomApplication.config.get('core.titleBar') is 'hidden'
close: -> @browserWindow.close()