diff --git a/.python-version b/.python-version index 4712731cc..ecc17b8e9 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -2.7.12 +2.7.13 diff --git a/package.json b/package.json index 92a9920e3..21f78352e 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "go-to-line": "0.32.0", "grammar-selector": "0.49.2", "image-view": "0.61.0", - "incompatible-packages": "0.26.1", + "incompatible-packages": "0.27.0", "keybinding-resolver": "0.36.1", "line-ending-selector": "0.6.1", "link": "0.31.2", diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index 86753a999..dae45f7a2 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -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() diff --git a/src/config-schema.js b/src/config-schema.js index 9bfa95a1a..41b5ecbb6 100644 --- a/src/config-schema.js +++ b/src/config-schema.js @@ -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.
Note: This currently does not include a proxy icon.
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`.
Note: Switching to a custom or hidden title bar will compromise some functionality.
This setting will require a relaunch of Atom to take effect.' } } diff --git a/src/main-process/atom-application.coffee b/src/main-process/atom-application.coffee index e2515ccb9..93e9e3395 100644 --- a/src/main-process/atom-application.coffee +++ b/src/main-process/atom-application.coffee @@ -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 diff --git a/src/main-process/atom-window.coffee b/src/main-process/atom-window.coffee index f3a9b394c..03386d31a 100644 --- a/src/main-process/atom-window.coffee +++ b/src/main-process/atom-window.coffee @@ -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() diff --git a/static/title-bar.less b/static/title-bar.less index 8191bc278..3eb2c4022 100644 --- a/static/title-bar.less +++ b/static/title-bar.less @@ -1,30 +1,32 @@ @import "ui-variables"; +@title-bar-height: 22px; +@traffic-lights-width: 68px; + +@inset-title-bar-height: 38px; +@inset-traffic-lights-width: 78px; + @title-bar-text-size: 13px; -@title-bar-height: 23px; @title-bar-background-color: @base-background-color; @title-bar-border-color: @base-border-color; -body.fullscreen .title-bar { - margin-top: -@title-bar-height; -} + +// Title Bar ------------------------------- .title-bar { - height: @title-bar-height; - transition: margin-top 160ms; - - flex-shrink: 0; display: flex; + flex-shrink: 0; align-items: center; justify-content: center; - + overflow: hidden; + box-sizing: content-box; font-size: @title-bar-text-size; + background-color: @title-bar-background-color; + border-bottom: 1px solid @title-bar-border-color; + transition: margin-top 160ms; -webkit-user-select: none; -webkit-app-region: drag; - padding: 0 70px; - overflow: hidden; - .title { flex: 0 1 auto; overflow: hidden; @@ -32,10 +34,54 @@ body.fullscreen .title-bar { text-overflow: ellipsis; } - background-color: @title-bar-background-color; - border-bottom: 1px solid @title-bar-border-color; - .is-blurred & { color: @text-color-subtle; } } + + +// Custom ------------------------------- + +.custom-title-bar { + .title-bar { + height: @title-bar-height; + padding-left: @traffic-lights-width; + padding-right: @traffic-lights-width; + } + + &.fullscreen .title-bar { + margin-top: -@title-bar-height; // hide title bar in fullscreen mode + } + + atom-panel.modal { + top: @title-bar-height; // Move modals down + } +} + + +// Custom Inset ------------------------------- + +.custom-inset-title-bar { + .title-bar { + height: @inset-title-bar-height; + padding-left: @inset-traffic-lights-width; + padding-right: @inset-traffic-lights-width; + } + + &.fullscreen .title-bar { + margin-top: -@inset-title-bar-height; // hide title bar in fullscreen mode + } + + atom-panel.modal { + top: @inset-title-bar-height; // Move modals down + } +} + + +// Hidden ------------------------------- + +.hidden-title-bar { + .status-bar { + -webkit-app-region: drag; // Enable dragging + } +}