From 18262d043b1caeb0fb1260c7b87824d5d84a5ad1 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Mon, 9 May 2016 17:22:39 -0700 Subject: [PATCH] fix(menus): Always show main win in menu, move Activity #1314 --- keymaps/base-darwin.json | 1 - keymaps/base-linux.json | 1 - menus/darwin.json | 2 -- menus/linux.json | 2 -- menus/win32.json | 2 -- src/browser/application-menu.coffee | 5 +++++ src/browser/application.es6 | 6 ------ src/browser/window-launcher.es6 | 1 + src/browser/window-manager.es6 | 2 +- 9 files changed, 7 insertions(+), 15 deletions(-) diff --git a/keymaps/base-darwin.json b/keymaps/base-darwin.json index c581ba794..04ef6d299 100644 --- a/keymaps/base-darwin.json +++ b/keymaps/base-darwin.json @@ -3,7 +3,6 @@ "application:hide": "command+h", "application:hide-other-applications": "command+alt+h", "application:zoom": "alt+command+ctrl+m", - "application:show-work-window": "mod+alt+w", "application:run-all-specs": "mod+alt+s", "application:run-package-specs": "mod+alt+p", diff --git a/keymaps/base-linux.json b/keymaps/base-linux.json index 6349a8e3c..b40318ff2 100644 --- a/keymaps/base-linux.json +++ b/keymaps/base-linux.json @@ -4,7 +4,6 @@ "window:toggle-full-screen": "f11", "window:reload": "mod+alt+l", "window:toggle-dev-tools": "mod+alt+i", - "application:show-work-window": "mod+alt+w", "application:run-all-specs": "mod+alt+s", "application:run-package-specs": "mod+alt+p" } diff --git a/menus/darwin.json b/menus/darwin.json index 0494f349b..b981dc44c 100644 --- a/menus/darwin.json +++ b/menus/darwin.json @@ -95,8 +95,6 @@ { "label": "Toggle Component Regions", "command": "window:toggle-component-regions" }, { "label": "Toggle Screenshot Mode", "command": "window:toggle-screenshot-mode" }, { "type": "separator" }, - { "label": "Open Activity Window", "command": "application:show-work-window" }, - { "type": "separator" }, { "label": "Create a Plugin...", "command": "application:create-package" }, { "label": "Install a Plugin...", "command": "application:install-package" }, { "type": "separator" }, diff --git a/menus/linux.json b/menus/linux.json index 0715c8f25..1045b6f9d 100644 --- a/menus/linux.json +++ b/menus/linux.json @@ -70,8 +70,6 @@ { "label": "Toggle Component Regions", "command": "window:toggle-component-regions" }, { "label": "Toggle Screenshot Mode", "command": "window:toggle-screenshot-mode" }, { "type": "separator" }, - { "label": "Open Activity Window", "command": "application:show-work-window" }, - { "type": "separator" }, { "label": "Create a Plugin...", "command": "application:create-package" }, { "label": "Install a Plugin...", "command": "application:install-package" }, { "type": "separator" }, diff --git a/menus/win32.json b/menus/win32.json index 7b717fb37..95990d3ff 100644 --- a/menus/win32.json +++ b/menus/win32.json @@ -52,8 +52,6 @@ { "label": "Toggle Component Regions", "command": "window:toggle-component-regions" }, { "label": "Toggle Screenshot Mode", "command": "window:toggle-screenshot-mode" }, { "type": "separator" }, - { "label": "Open Activity Window", "command": "application:show-work-window" }, - { "type": "separator" }, { "label": "Create a Plugin...", "command": "application:create-package" }, { "label": "Install a Plugin...", "command": "application:install-package" }, { "type": "separator" }, diff --git a/src/browser/application-menu.coffee b/src/browser/application-menu.coffee index ca6d20786..6bf1e167c 100644 --- a/src/browser/application-menu.coffee +++ b/src/browser/application-menu.coffee @@ -109,9 +109,14 @@ class ApplicationMenu return unless windowMenu idx = _.findIndex(windowMenu.submenu, ({id}) -> id is 'window-list-separator') + accelerators = { + 'default': 'CmdOrCtrl+0', + 'work': 'CmdOrCtrl+alt+w', + } windows = global.application.windowManager.getOpenWindows() windowsItems = windows.map (w) => { label: w.loadSettings().title || "Window" + accelerator: accelerators[w.windowType] click: -> w.show() w.focus() diff --git a/src/browser/application.es6 b/src/browser/application.es6 index 0bbb6b906..bf44f5542 100644 --- a/src/browser/application.es6 +++ b/src/browser/application.es6 @@ -325,12 +325,6 @@ export default class Application extends EventEmitter { this.openWindowsForTokenState(); }); - this.on('application:show-work-window', () => { - const win = this.windowManager.get(WindowManager.WORK_WINDOW) - win.show() - win.focus() - }); - this.on('application:check-for-update', () => { this.autoUpdateManager.check(); }); diff --git a/src/browser/window-launcher.es6 b/src/browser/window-launcher.es6 index 69ce4b53e..cbf5931a7 100644 --- a/src/browser/window-launcher.es6 +++ b/src/browser/window-launcher.es6 @@ -57,6 +57,7 @@ export default class WindowLauncher { // This will fire `NylasEnv::populateHotWindow` and reload the // packages. win.windowKey = opts.windowKey; + win.windowType = opts.windowType; win.setLoadSettings(newLoadSettings); } diff --git a/src/browser/window-manager.es6 b/src/browser/window-manager.es6 index ebb282362..c438433ab 100644 --- a/src/browser/window-manager.es6 +++ b/src/browser/window-manager.es6 @@ -28,7 +28,7 @@ export default class WindowManager { const values = []; Object.keys(this._windows).forEach((key) => { const win = this._windows[key]; - if (win.isVisible() || win.isMinimized()) { + if (win.windowType !== WindowLauncher.EMPTY_WINDOW) { values.push(win); } });