From 53107fa0981b154033d14cbbd9895074bd677a75 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Wed, 30 Jan 2019 13:26:00 -0500 Subject: [PATCH] feat: support mac swipe Can also add up for Explore navigation in the future --- src/main/createWindow.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/createWindow.js b/src/main/createWindow.js index df36a782c..4ac1860ee 100644 --- a/src/main/createWindow.js +++ b/src/main/createWindow.js @@ -72,15 +72,28 @@ export default appState => { } setupBarMenu(); - - window.on('app-command', function(e, cmd) { + // Windows back/forward mouse navigation + window.on('app-command', (e, cmd) => { switch (cmd) { case 'browser-backward': window.webContents.send('navigate-backward', null); - return; + break; case 'browser-forward': window.webContents.send('navigate-forward', null); - return; + break; + default: // Do nothing + } + }); + // Mac back/forward swipe navigation + window.on('swipe', (e, dir) => { + switch (dir) { + case 'left': + window.webContents.send('navigate-backward', null); + break; + case 'right': + window.webContents.send('navigate-forward', null); + break; + default: // Do nothing } });