Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add mouse back/forward navigation #2250

Merged
merged 5 commits into from Jan 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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