From 73a70d430fabf9ffd366dc15da4f998fdaebbd8a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 17 Nov 2014 13:44:51 -0800 Subject: [PATCH 01/13] Add core.autoHideMenuBar --- src/config-schema.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 87589f68a..bbe27cf10 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -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.autoHideMenuBar = + type: 'boolean' + default: false + title: 'Automatically hide the menu bar. This is only supported on Linux and Windows' From 79e50084a9777cb534053329bbfead5c9230148b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 17 Nov 2014 13:45:27 -0800 Subject: [PATCH 02/13] Set description, not title --- src/config-schema.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index bbe27cf10..346b4f560 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -192,4 +192,4 @@ if process.platform in ['win32', 'linux'] module.exports.core.autoHideMenuBar = type: 'boolean' default: false - title: 'Automatically hide the menu bar. This is only supported on Linux and Windows' + description: 'Automatically hide the menu bar. This is only supported on Linux and Windows' From ee7d4003de77d922b8c8128a8fc5dd5cdbbe03f3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 17 Nov 2014 13:53:33 -0800 Subject: [PATCH 03/13] Add toggle menu bar item --- menus/win32.cson | 1 + 1 file changed, 1 insertion(+) diff --git a/menus/win32.cson b/menus/win32.cson index e316dd107..3ce871942 100644 --- a/menus/win32.cson +++ b/menus/win32.cson @@ -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: [ From 7bcf92e55a24c03afaa7a61be8076bbef5aee77c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 17 Nov 2014 13:54:39 -0800 Subject: [PATCH 04/13] Implement menu bar toggling --- src/atom.coffee | 7 +++++++ src/window-event-handler.coffee | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/atom.coffee b/src/atom.coffee index 15787494f..a53a1f0a1 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -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,6 @@ class Atom extends Model setBodyPlatformClass: -> document.body.classList.add("platform-#{process.platform}") + + setAutoHideMenuBar: (autoHide) -> + ipc.send('call-window-method', 'setAutoHideMenuBar', autoHide) diff --git a/src/window-event-handler.coffee b/src/window-event-handler.coffee index 5eb35ddf6..6090f3b2e 100644 --- a/src/window-event-handler.coffee +++ b/src/window-event-handler.coffee @@ -60,6 +60,8 @@ class WindowEventHandler atom.reload() @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 From 18c6c84d351c7f19183a4086a5b24b24fa578940 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 17 Nov 2014 14:01:20 -0800 Subject: [PATCH 05/13] :arrow_up: donna@1.0.7 --- build/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/package.json b/build/package.json index bd7a32f1d..99a8bf57c 100644 --- a/build/package.json +++ b/build/package.json @@ -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", From 7422f0ab1b4b5dbf307f12c7af88e4c7f176d539 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 17 Nov 2014 14:14:34 -0800 Subject: [PATCH 06/13] Set menu bar visible when no longer autohiding --- src/atom.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/atom.coffee b/src/atom.coffee index a53a1f0a1..4883bfb89 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -730,3 +730,5 @@ class Atom extends Model setAutoHideMenuBar: (autoHide) -> ipc.send('call-window-method', 'setAutoHideMenuBar', autoHide) + unless autoHide + ipc.send('call-window-method', 'setMenuBarVisibility', true) From b47d52d919a6b088a24055f7386d0b92451352e8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 17 Nov 2014 14:17:13 -0800 Subject: [PATCH 07/13] Always set menu bar visibility when changing autohide --- src/atom.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 4883bfb89..944e5049d 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -730,5 +730,4 @@ class Atom extends Model setAutoHideMenuBar: (autoHide) -> ipc.send('call-window-method', 'setAutoHideMenuBar', autoHide) - unless autoHide - ipc.send('call-window-method', 'setMenuBarVisibility', true) + ipc.send('call-window-method', 'setMenuBarVisibility', !autoHide) From a9826653e1ad70b3e8a4bdef0f921b8e17f971e6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 17 Nov 2014 14:22:58 -0800 Subject: [PATCH 08/13] Set autoHideMenuBar on properties object --- src/config-schema.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 346b4f560..2ece0267f 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -189,7 +189,7 @@ module.exports = 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.autoHideMenuBar = + module.exports.core.properties.autoHideMenuBar = type: 'boolean' default: false description: 'Automatically hide the menu bar. This is only supported on Linux and Windows' From 59c405d846eb1cc410c4fd39f62cc6023af3c486 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 17 Nov 2014 14:36:56 -0800 Subject: [PATCH 09/13] Mention Alt shows the menu bar --- src/config-schema.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 2ece0267f..525724caa 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -192,4 +192,4 @@ if process.platform in ['win32', 'linux'] module.exports.core.properties.autoHideMenuBar = type: 'boolean' default: false - description: 'Automatically hide the menu bar. This is only supported on Linux and Windows' + description: 'Automatically hide the menu bar and show it when Alt is pressed. This is only supported on Linux and Windows' From 913c002ee471fb5040e77937d88f26f5e2b24d3d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 17 Nov 2014 14:38:56 -0800 Subject: [PATCH 10/13] :penguin: Add Toggle Menu Bar to View menu --- menus/linux.cson | 1 + 1 file changed, 1 insertion(+) diff --git a/menus/linux.cson b/menus/linux.cson index 911dbd33e..3134c8af8 100644 --- a/menus/linux.cson +++ b/menus/linux.cson @@ -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: [ From c360ccc62b9e64a3055a53c9aa0ae78441ade60c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 17 Nov 2014 14:40:24 -0800 Subject: [PATCH 11/13] Only register command on Windows & Linux --- src/window-event-handler.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/window-event-handler.coffee b/src/window-event-handler.coffee index 6090f3b2e..3d416a86b 100644 --- a/src/window-event-handler.coffee +++ b/src/window-event-handler.coffee @@ -60,8 +60,10 @@ class WindowEventHandler atom.reload() @subscribeToCommand $(window), 'window:toggle-dev-tools', -> atom.toggleDevTools() - @subscribeToCommand $(window), 'window:toggle-menu-bar', -> - atom.config.set('core.autoHideMenuBar', !atom.config.get('core.autoHideMenuBar')) + + 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 From 4896741f0c11ec7c273075eab8a05326ba5743e6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 17 Nov 2014 14:48:41 -0800 Subject: [PATCH 12/13] :memo: Mention Alt toggles --- src/config-schema.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 525724caa..2bbd01467 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -192,4 +192,4 @@ if process.platform in ['win32', 'linux'] module.exports.core.properties.autoHideMenuBar = type: 'boolean' default: false - description: 'Automatically hide the menu bar and show it when Alt is pressed. This is only supported on Linux and Windows' + description: 'Automatically hide the menu bar and toggle it by pressing Alt. This is only supported on Linux and Windows' From 40ffe2a306288d1e21161b218f48d6dd4a98d163 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 17 Nov 2014 16:52:48 -0800 Subject: [PATCH 13/13] :memo: Swap OS order --- src/config-schema.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 2bbd01467..97e9e6e58 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -192,4 +192,4 @@ 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 Linux and Windows' + description: 'Automatically hide the menu bar and toggle it by pressing Alt. This is only supported on Windows & Linux.'