Merge pull request #2250 from lbryio/mouse-nav

feat: add mouse back/forward navigation
This commit is contained in:
Sean Yesmunt 2019-01-31 11:57:15 -05:00 committed by GitHub
commit dc36f907b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 2 deletions

View file

@ -8,10 +8,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added ### 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)) - 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)) - 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)) - Autoplay content in list of related files ([#2235](https://github.com/lbryio/lbry-desktop/pull/2235))
- Support for back/forward mouse navigation on Windows ([#2250](https://github.com/lbryio/lbry-desktop/pull/2250))
### Changed ### Changed

View file

@ -73,6 +73,19 @@ export default appState => {
setupBarMenu(); setupBarMenu();
// Windows back/forward mouse navigation
window.on('app-command', (e, cmd) => {
switch (cmd) {
case 'browser-backward':
window.webContents.send('navigate-backward', null);
break;
case 'browser-forward':
window.webContents.send('navigate-forward', null);
break;
default: // Do nothing
}
});
window.on('close', event => { window.on('close', event => {
if (!appState.isQuitting && !appState.autoUpdateAccepted) { if (!appState.isQuitting && !appState.autoUpdateAccepted) {
event.preventDefault(); event.preventDefault();

View file

@ -18,7 +18,7 @@ import {
doHideModal, doHideModal,
} from 'redux/actions/app'; } from 'redux/actions/app';
import { doToast, doBlackListedOutpointsSubscribe, isURIValid, setSearchApi } from 'lbry-redux'; 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 { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
import { doAuthenticate, Lbryio, rewards } from 'lbryinc'; import { doAuthenticate, Lbryio, rewards } from 'lbryinc';
import 'scss/all.scss'; import 'scss/all.scss';
@ -41,6 +41,14 @@ if (process.env.SEARCH_API_URL) {
setSearchApi(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 need to override Lbryio for getting/setting the authToken
// We interect with ipcRenderer to get the auth key from a users keyring // 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 // We keep a local variable for authToken beacuse `ipcRenderer.send` does not