mirror of
https://github.com/atom/atom.git
synced 2026-02-16 09:35:54 -05:00
make custom titlebar user-configurable and prompt for relaunch on change
This commit is contained in:
@@ -196,7 +196,6 @@ class AtomEnvironment extends Model
|
||||
notificationManager: @notifications, @applicationDelegate, @clipboard, viewRegistry: @views, assert: @assert.bind(this)
|
||||
})
|
||||
|
||||
@titleBar = new TitleBar() if process.platform is 'darwin'
|
||||
@themes.workspace = @workspace
|
||||
|
||||
@textEditors = new TextEditorRegistry
|
||||
@@ -204,6 +203,9 @@ class AtomEnvironment extends Model
|
||||
|
||||
@config.load()
|
||||
|
||||
# This needs to happen after config.load()
|
||||
@titleBar = new TitleBar() if process.platform is 'darwin' and @config.get('core.useCustomTitleBar')
|
||||
|
||||
@themes.loadBaseStylesheets()
|
||||
@initialStyleElements = @styles.getSnapshot()
|
||||
@themes.initialLoadComplete = true if onlyLoadBaseStyleSheets
|
||||
|
||||
@@ -266,3 +266,9 @@ if process.platform in ['win32', 'linux']
|
||||
type: 'boolean'
|
||||
default: false
|
||||
description: 'Automatically hide the menu bar and toggle it by pressing Alt. This is only supported on Windows & Linux.'
|
||||
|
||||
if process.platform is 'darwin'
|
||||
module.exports.core.properties.useCustomTitleBar =
|
||||
type: 'boolean'
|
||||
default: false
|
||||
description: 'Use custom, theme-aware title-bar.<br />Note: This currently does not include a file icon or title context menu.<br />This setting will require a relaunch of Atom to take effect.'
|
||||
|
||||
@@ -76,6 +76,8 @@ class AtomApplication
|
||||
@config.setSchema null, {type: 'object', properties: _.clone(require('../config-schema'))}
|
||||
@config.load()
|
||||
|
||||
@config.onDidChange 'core.useCustomTitleBar', @promptForRelaunch
|
||||
|
||||
@autoUpdateManager = new AutoUpdateManager(@version, options.test, @resourcePath, @config)
|
||||
@applicationMenu = new ApplicationMenu(@version, @autoUpdateManager)
|
||||
@atomProtocolHandler = new AtomProtocolHandler(@resourcePath, @safeMode)
|
||||
@@ -87,6 +89,7 @@ class AtomApplication
|
||||
@setupDockMenu()
|
||||
@storageFolder = new StorageFolder(process.env.ATOM_HOME)
|
||||
|
||||
|
||||
if options.pathsToOpen?.length > 0 or options.urlsToOpen?.length > 0 or options.test
|
||||
@openWithOptions(options)
|
||||
else
|
||||
@@ -706,3 +709,16 @@ class AtomApplication
|
||||
openOptions.defaultPath = path
|
||||
|
||||
dialog.showOpenDialog(parentWindow, openOptions, callback)
|
||||
|
||||
promptForRelaunch: ->
|
||||
chosen = dialog.showMessageBox BrowserWindow.getFocusedWindow(),
|
||||
type: 'warning'
|
||||
title: 'Relaunch required'
|
||||
message: "To apply this setting, you'll need to relaunch Atom."
|
||||
detail: ''
|
||||
buttons: ['Relaunch Atom', 'Cancel']
|
||||
if chosen is 0
|
||||
# once we're using electron v.1.2.2
|
||||
# app.relaunch()
|
||||
app.quit()
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class AtomWindow
|
||||
if process.platform is 'linux'
|
||||
options.icon = @constructor.iconPath
|
||||
|
||||
if process.platform is 'darwin'
|
||||
if process.platform is 'darwin' and global.atomApplication.config.get('core.useCustomTitleBar')
|
||||
options.titleBarStyle = 'hidden'
|
||||
|
||||
@browserWindow = new BrowserWindow options
|
||||
|
||||
Reference in New Issue
Block a user