From 4bfb6eb200ce2979124198764d55d35d29c67ba5 Mon Sep 17 00:00:00 2001 From: Opender Singh Date: Tue, 6 Aug 2019 06:38:19 +1200 Subject: [PATCH] Add back View > Toggle Sidebar item (#1548) * Add View > Toggle Sidebar item back * Remove from _globalKeyMap to prevent double toggle * Remove sidebar toggle hotkeys --- packages/insomnia-app/app/common/hotkeys.js | 7 ------- packages/insomnia-app/app/main/window-utils.js | 12 ++++++++++++ .../app/ui/components/settings/shortcuts.js | 1 - packages/insomnia-app/app/ui/containers/app.js | 1 - 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/insomnia-app/app/common/hotkeys.js b/packages/insomnia-app/app/common/hotkeys.js index 2eeaead86..4dbb37c64 100644 --- a/packages/insomnia-app/app/common/hotkeys.js +++ b/packages/insomnia-app/app/common/hotkeys.js @@ -98,8 +98,6 @@ export const hotKeyRefs = { TOGGLE_MAIN_MENU: defineHotKey('toggleMainMenu', 'Toggle Main Menu'), - SIDEBAR_TOGGLE: defineHotKey('sidebar_toggle', 'Toggle Sidebar'), - REQUEST_QUICK_SWITCH: defineHotKey('request_quickSwitch', 'Switch Requests'), SHOW_RECENT_REQUESTS: defineHotKey('request_showRecent', 'Show Recent Requests'), @@ -189,11 +187,6 @@ const defaultRegistry: HotKeyRegistry = { keyComb(true, true, false, false, keyboardKeys.comma.keyCode), ), - [hotKeyRefs.SIDEBAR_TOGGLE.id]: keyBinds( - keyComb(false, false, false, true, keyboardKeys.backslash.keyCode), - keyComb(true, false, false, false, keyboardKeys.backslash.keyCode), - ), - [hotKeyRefs.REQUEST_QUICK_SWITCH.id]: keyBinds( keyComb(false, false, false, true, keyboardKeys.p.keyCode), keyComb(true, false, false, false, keyboardKeys.p.keyCode), diff --git a/packages/insomnia-app/app/main/window-utils.js b/packages/insomnia-app/app/main/window-utils.js index d8919d898..aa289f195 100644 --- a/packages/insomnia-app/app/main/window-utils.js +++ b/packages/insomnia-app/app/main/window-utils.js @@ -205,6 +205,18 @@ export function createWindow() { saveZoomFactor(zoomFactor); }, }, + { + label: 'Toggle Sidebar', + accelerator: 'CmdOrCtrl+\\', + click: () => { + const w = BrowserWindow.getFocusedWindow(); + if (!w || !w.webContents) { + return; + } + + w.webContents.send('toggle-sidebar'); + }, + }, { label: `Toggle ${MNEMONIC_SYM}DevTools`, click: () => mainWindow.toggleDevTools(), diff --git a/packages/insomnia-app/app/ui/components/settings/shortcuts.js b/packages/insomnia-app/app/ui/components/settings/shortcuts.js index b68d167db..738afcd65 100644 --- a/packages/insomnia-app/app/ui/components/settings/shortcuts.js +++ b/packages/insomnia-app/app/ui/components/settings/shortcuts.js @@ -41,7 +41,6 @@ const HOT_KEY_DEFS: Array = [ hotKeyRefs.REQUEST_FOCUS_URL, hotKeyRefs.RESPONSE_FOCUS, hotKeyRefs.REQUEST_TOGGLE_HTTP_METHOD_MENU, - hotKeyRefs.SIDEBAR_TOGGLE, hotKeyRefs.SIDEBAR_FOCUS_FILTER, hotKeyRefs.REQUEST_TOGGLE_HISTORY, hotKeyRefs.SHOW_AUTOCOMPLETE, diff --git a/packages/insomnia-app/app/ui/containers/app.js b/packages/insomnia-app/app/ui/containers/app.js index a1441a792..6aab95705 100644 --- a/packages/insomnia-app/app/ui/containers/app.js +++ b/packages/insomnia-app/app/ui/containers/app.js @@ -246,7 +246,6 @@ class App extends PureComponent { await this._handleSetRequestPinned(this.props.activeRequest, !(metas && metas.pinned)); }, ], - [hotKeyRefs.SIDEBAR_TOGGLE, this._handleToggleSidebar], [hotKeyRefs.PLUGIN_RELOAD, this._handleReloadPlugins], [ hotKeyRefs.ENVIRONMENT_UNCOVER_VARIABLES,