Merge pull request #4215 from atom/ks-toggle-menu-bar

Support automatically hiding the menu bar
This commit is contained in:
Kevin Sawicki
2014-11-17 17:07:04 -08:00
6 changed files with 21 additions and 1 deletions

View File

@@ -7,7 +7,7 @@
},
"dependencies": {
"async": "~0.2.9",
"donna": "1.0.6",
"donna": "1.0.7",
"formidable": "~1.0.14",
"fs-plus": "2.x",
"github-releases": "~0.2.0",

View File

@@ -94,6 +94,7 @@
submenu: [
{ label: '&Reload', command: 'window:reload' }
{ label: 'Toggle &Full Screen', command: 'window:toggle-full-screen' }
{ label: 'Toggle Menu Bar', command: 'window:toggle-menu-bar' }
{
label: 'Developer'
submenu: [

View File

@@ -93,6 +93,7 @@
submenu: [
{ label: '&Reload', command: 'window:reload' }
{ label: 'Toggle &Full Screen', command: 'window:toggle-full-screen' }
{ label: 'Toggle Menu Bar', command: 'window:toggle-menu-bar' }
{
label: 'Panes'
submenu: [

View File

@@ -503,7 +503,11 @@ class Atom extends Model
@packages.activate()
@keymaps.loadUserKeymap()
@requireUserInitScript() unless safeMode
@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'
@displayWindow({maximize})
@@ -723,3 +727,7 @@ class Atom extends Model
setBodyPlatformClass: ->
document.body.classList.add("platform-#{process.platform}")
setAutoHideMenuBar: (autoHide) ->
ipc.send('call-window-method', 'setAutoHideMenuBar', autoHide)
ipc.send('call-window-method', 'setMenuBarVisibility', !autoHide)

View File

@@ -187,3 +187,9 @@ module.exports =
type: 'boolean'
default: process.platform isnt 'darwin'
description: 'Increase/decrease the editor font size when pressing the Ctrl key and scrolling the mouse up/down.'
if process.platform in ['win32', 'linux']
module.exports.core.properties.autoHideMenuBar =
type: 'boolean'
default: false
description: 'Automatically hide the menu bar and toggle it by pressing Alt. This is only supported on Windows & Linux.'

View File

@@ -61,6 +61,10 @@ class WindowEventHandler
@subscribeToCommand $(window), 'window:toggle-dev-tools', -> atom.toggleDevTools()
if process.platform in ['win32', 'linux']
@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-previous', @focusPrevious