Skip to content

Commit a6d5158

Browse files
committed
electron support for mouse forward/back buttons in Windows
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent 55084d3 commit a6d5158

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎electron_app/src/electron-main.js‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,17 @@ electron.app.on('ready', () => {
228228
}
229229
});
230230

231+
if (process.platform === 'win32') {
232+
// Handle forward/backward mouse buttons in Windows
233+
mainWindow.on('app-command', (e, cmd) => {
234+
if (cmd === 'browser-backward' && mainWindow.webContents.canGoBack()) {
235+
mainWindow.webContents.goBack();
236+
} else if (cmd === 'browser-forward' && mainWindow.webContents.canGoForward()) {
237+
mainWindow.webContents.goForward();
238+
}
239+
});
240+
}
241+
231242
webContentsHandler(mainWindow.webContents);
232243
mainWindowState.manage(mainWindow);
233244
});

0 commit comments

Comments
 (0)