feat(keybindings): add mouse button support for mpv keybindings (#103)

This commit is contained in:
2026-05-31 22:22:38 -07:00
committed by GitHub
parent e6a004ab8b
commit 487143802a
14 changed files with 281 additions and 5 deletions
+18
View File
@@ -5,6 +5,7 @@ import {
buildMpvKeybindingConfigValue,
createMpvKeybindingRows,
keyboardEventToConfigKey,
mouseEventToConfigKey,
} from './key-input';
test('keyboardEventToConfigKey formats Electron accelerators from learned input', () => {
@@ -75,6 +76,23 @@ test('keyboardEventToConfigKey formats mpv key bindings from learned input', ()
);
});
test('mouseEventToConfigKey formats mpv mouse buttons from learned input', () => {
assert.equal(
mouseEventToConfigKey(
{ button: 3, ctrlKey: false, altKey: false, shiftKey: false, metaKey: false },
'dom-code',
),
'MBTN_BACK',
);
assert.equal(
mouseEventToConfigKey(
{ button: 4, ctrlKey: false, altKey: true, shiftKey: true, metaKey: false },
'dom-code',
),
'Alt+Shift+MBTN_FORWARD',
);
});
test('MPV keybinding rows save default key moves as a disable plus replacement', () => {
const defaults: Keybinding[] = [{ key: 'Space', command: ['cycle', 'pause'] }];
const rows = createMpvKeybindingRows(defaults, []);