Skip to content

Commit

Permalink
Merge pull request #2250 from lbryio/mouse-nav
Browse files Browse the repository at this point in the history
feat: add mouse back/forward navigation
  • Loading branch information
Sean Yesmunt committed Jan 31, 2019
2 parents 0c213bf + 662ddb4 commit dc36f90
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -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 ([#2250](https://github.com/lbryio/lbry-desktop/pull/2250))

### Changed

Expand Down
13 changes: 13 additions & 0 deletions src/main/createWindow.js
Expand Up @@ -73,6 +73,19 @@ export default appState => {

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 => {
if (!appState.isQuitting && !appState.autoUpdateAccepted) {
event.preventDefault();
Expand Down
10 changes: 9 additions & 1 deletion src/renderer/index.js
Expand Up @@ -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';
Expand All @@ -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
Expand Down

0 comments on commit dc36f90

Please sign in to comment.