feat: support mac swipe

Can also add up for Explore navigation in the future
This commit is contained in:
Thomas Zarebczan 2019-01-30 13:26:00 -05:00
parent b5fa7d50e5
commit 53107fa098

View file

@ -72,15 +72,28 @@ export default appState => {
} }
setupBarMenu(); setupBarMenu();
// Windows back/forward mouse navigation
window.on('app-command', function(e, cmd) { window.on('app-command', (e, cmd) => {
switch (cmd) { switch (cmd) {
case 'browser-backward': case 'browser-backward':
window.webContents.send('navigate-backward', null); window.webContents.send('navigate-backward', null);
return; break;
case 'browser-forward': case 'browser-forward':
window.webContents.send('navigate-forward', null); 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
} }
}); });