Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit 756c8c5

Browse files
Merge pull request #922 from gergelypolonkai/linux-mouse-navigation
Make it possible to navigate with mouse forward/back buttons in Linux
2 parents 5f96457 + b75d6e4 commit 756c8c5

File tree

3 files changed

+159
-90
lines changed

3 files changed

+159
-90
lines changed

main-window.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var ref = require('ssb-ref')
1313
var setupContextMenuAndSpellCheck = require('./lib/context-menu-and-spellcheck')
1414
var watch = require('mutant/watch')
1515
var requireStyle = require('require-style')
16+
var mouseForwardBack = require('mouse-forward-back')
1617

1718
module.exports = function (config) {
1819
var sockets = combine(
@@ -85,6 +86,17 @@ module.exports = function (config) {
8586
electron.ipcRenderer.on('goForward', views.goForward)
8687
electron.ipcRenderer.on('goBack', views.goBack)
8788

89+
if (mouseForwardBack) {
90+
mouseForwardBack.register((direction) => {
91+
if (direction === 'back') {
92+
views.goBack()
93+
} else if (direction === 'forward') {
94+
views.goForward()
95+
}
96+
},
97+
electron.remote.getCurrentWindow().getNativeWindowHandle())
98+
}
99+
88100
document.head.appendChild(
89101
h('style', {
90102
innerHTML: computed(api.settings.obs.get('patchwork.theme', 'light'), themeName => {

0 commit comments

Comments
 (0)