From 525de82d36ad8251c0ae3714d08732c339d0d4f1 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Wed, 30 Jan 2019 00:35:36 -0500 Subject: [PATCH 1/5] feat: add mouse navigation Simple support for back/forward mouse buttons. Need to test on Mac and Linux. --- src/main/createWindow.js | 11 +++++++++++ src/renderer/index.js | 10 +++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/createWindow.js b/src/main/createWindow.js index b26ada7e0ed..df36a782c6d 100644 --- a/src/main/createWindow.js +++ b/src/main/createWindow.js @@ -73,6 +73,17 @@ export default appState => { setupBarMenu(); + window.on('app-command', function(e, cmd) { + switch (cmd) { + case 'browser-backward': + window.webContents.send('navigate-backward', null); + return; + case 'browser-forward': + window.webContents.send('navigate-forward', null); + return; + } + }); + window.on('close', event => { if (!appState.isQuitting && !appState.autoUpdateAccepted) { event.preventDefault(); diff --git a/src/renderer/index.js b/src/renderer/index.js index 0d684743891..0f4b8d98f83 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -18,7 +18,7 @@ import { doHideModal, } from 'redux/actions/app'; import { doToast, doBlackListedOutpointsSubscribe, isURIValid, setSearchApi } from 'lbry-redux'; -import { doNavigate } from 'redux/actions/navigation'; +import { doNavigate, doHistoryBack, doHistoryForward } from 'redux/actions/navigation'; import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings'; import { doAuthenticate, Lbryio, rewards } from 'lbryinc'; import 'scss/all.scss'; @@ -41,6 +41,14 @@ if (process.env.SEARCH_API_URL) { setSearchApi(process.env.SEARCH_API_URL); } +ipcRenderer.on('navigate-backward', () => { + app.store.dispatch(doHistoryBack()); +}); + +ipcRenderer.on('navigate-forward', () => { + app.store.dispatch(doHistoryForward()); +}); + // We need to override Lbryio for getting/setting the authToken // We interect with ipcRenderer to get the auth key from a users keyring // We keep a local variable for authToken beacuse `ipcRenderer.send` does not From b5fa7d50e5750e674eed0b04896f80c593ae03d3 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Wed, 30 Jan 2019 09:09:40 -0500 Subject: [PATCH 2/5] changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a47b108b43..3c7e2644ee7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added -- Support for sandbox applications ([#2178](https://github.com/lbryio/lbry-desktop/pull/2178)) +- Support for sandbox games and applications ([#2178](https://github.com/lbryio/lbry-desktop/pull/2178)) - CTA to invite page on first run ([#2221](https://github.com/lbryio/lbry-desktop/pull/2221)) - Responsive related content list ([#2226](https://github.com/lbryio/lbry-desktop/pull/2226)) - Autoplay content in list of related files ([#2235](https://github.com/lbryio/lbry-desktop/pull/2235)) +- Support for back/forward mouse navigation on Windows/OSX ([#855](https://github.com/lbryio/lbry-desktop/issues/885)) ### Changed From 53107fa0981b154033d14cbbd9895074bd677a75 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Wed, 30 Jan 2019 13:26:00 -0500 Subject: [PATCH 3/5] 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 df36a782c6d..4ac1860eedd 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 } }); From 37f784e3b00348ed250be02f20f815f9e32370f9 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Thu, 31 Jan 2019 08:32:44 -0500 Subject: [PATCH 4/5] remove mac Doesn't work with 3 finger swipe, 2 finger not supported. --- src/main/createWindow.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/main/createWindow.js b/src/main/createWindow.js index 4ac1860eedd..ff4f5e76b7d 100644 --- a/src/main/createWindow.js +++ b/src/main/createWindow.js @@ -72,6 +72,7 @@ export default appState => { } setupBarMenu(); + // Windows back/forward mouse navigation window.on('app-command', (e, cmd) => { switch (cmd) { @@ -84,18 +85,6 @@ export default appState => { 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 - } - }); window.on('close', event => { if (!appState.isQuitting && !appState.autoUpdateAccepted) { From 662ddb46ca8e836f38f665e2b3308213230007a4 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Thu, 31 Jan 2019 08:35:09 -0500 Subject: [PATCH 5/5] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c7e2644ee7..9b0e943929d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - CTA to invite page on first run ([#2221](https://github.com/lbryio/lbry-desktop/pull/2221)) - Responsive related content list ([#2226](https://github.com/lbryio/lbry-desktop/pull/2226)) - Autoplay content in list of related files ([#2235](https://github.com/lbryio/lbry-desktop/pull/2235)) -- Support for back/forward mouse navigation on Windows/OSX ([#855](https://github.com/lbryio/lbry-desktop/issues/885)) +- Support for back/forward mouse navigation on Windows ([#2250](https://github.com/lbryio/lbry-desktop/pull/2250)) ### Changed