Implement menu bar toggling

This commit is contained in:
Kevin Sawicki 2014-11-17 13:54:39 -08:00
parent ee7d4003de
commit 7bcf92e55a
2 changed files with 9 additions and 0 deletions

View File

@ -503,7 +503,11 @@ class Atom extends Model
@packages.activate() @packages.activate()
@keymaps.loadUserKeymap() @keymaps.loadUserKeymap()
@requireUserInitScript() unless safeMode @requireUserInitScript() unless safeMode
@menu.update() @menu.update()
@subscribe @config.onDidChange 'core.autoHideMenuBar', ({newValue}) =>
@setAutoHideMenuBar(newValue)
@setAutoHideMenuBar(true) if @config.get('core.autoHideMenuBar')
maximize = dimensions?.maximized and process.platform isnt 'darwin' maximize = dimensions?.maximized and process.platform isnt 'darwin'
@displayWindow({maximize}) @displayWindow({maximize})
@ -723,3 +727,6 @@ class Atom extends Model
setBodyPlatformClass: -> setBodyPlatformClass: ->
document.body.classList.add("platform-#{process.platform}") document.body.classList.add("platform-#{process.platform}")
setAutoHideMenuBar: (autoHide) ->
ipc.send('call-window-method', 'setAutoHideMenuBar', autoHide)

View File

@ -60,6 +60,8 @@ class WindowEventHandler
atom.reload() atom.reload()
@subscribeToCommand $(window), 'window:toggle-dev-tools', -> atom.toggleDevTools() @subscribeToCommand $(window), 'window:toggle-dev-tools', -> atom.toggleDevTools()
@subscribeToCommand $(window), 'window:toggle-menu-bar', ->
atom.config.set('core.autoHideMenuBar', !atom.config.get('core.autoHideMenuBar'))
@subscribeToCommand $(document), 'core:focus-next', @focusNext @subscribeToCommand $(document), 'core:focus-next', @focusNext