feat(overlay): forward mpv mouse and wheel bindings through overlay

- Accept WHEEL_UP/DOWN/LEFT/RIGHT (with modifiers) in keybindings, the plugin, and the settings key editor
- Forward mpv's MBTN_* and WHEEL_* bindings from the overlay so double-click fullscreen, wheel volume, and similar inputs work on Hyprland; SubMiner bindings and right-click pause still win
- Notify the overlay via mpv-input-bindings:changed when mpv's key set changes, fixing dead imported keys when the overlay loads before mpv connects
- Sync README requirements/quick start with the installation guide and fix the Arch MeCab install command (AUR mecab-git)
This commit is contained in:
sudacode committed 2026-10-01 01:16:44 -07:00
commit a6df21bdc2
29 files changed
+643 -157

No files matched your search

+3 -1
View File
@@ -212,12 +212,13 @@ test('compileSessionBindings resolves CommandOrControl in DOM key strings per pl
);
});
test('compileSessionBindings supports mpv mouse button keybindings', () => {
test('compileSessionBindings supports mpv mouse button and wheel keybindings', () => {
const result = compileSessionBindings({
shortcuts: createShortcuts(),
keybindings: [
createKeybinding('MBTN_BACK', ['sub-seek', -1]),
createKeybinding('Shift+MBTN_FORWARD', ['sub-seek', 1]),
createKeybinding('Ctrl+WHEEL_UP', ['add', 'sub-scale', 0.1]),
],
platform: 'win32',
});
@@ -232,6 +233,7 @@ test('compileSessionBindings supports mpv mouse button keybindings', () => {
[
{ code: 'MBTN_BACK', modifiers: [], command: ['sub-seek', -1] },
{ code: 'MBTN_FORWARD', modifiers: ['shift'], command: ['sub-seek', 1] },
{ code: 'WHEEL_UP', modifiers: ['ctrl'], command: ['add', 'sub-scale', 0.1] },
],
);
});
+9 -5
View File
@@ -34,12 +34,16 @@ type DraftBinding = {
};
const MODIFIER_ORDER: SessionKeyModifier[] = ['ctrl', 'alt', 'shift', 'meta'];
const MPV_MOUSE_BUTTON_CODES = new Set([
const MPV_MOUSE_CODES = new Set([
'MBTN_LEFT',
'MBTN_MID',
'MBTN_RIGHT',
'MBTN_BACK',
'MBTN_FORWARD',
'WHEEL_UP',
'WHEEL_DOWN',
'WHEEL_LEFT',
'WHEEL_RIGHT',
]);
const SESSION_SHORTCUT_ACTIONS: Array<{
@@ -82,7 +86,7 @@ function isValidCommandEntry(value: unknown): value is string | number {
function normalizeCodeToken(
token: string,
options: { allowMouseButtons?: boolean } = {},
options: { allowMouseInput?: boolean } = {},
): string | null {
const normalized = token.trim();
if (!normalized) return null;
@@ -93,9 +97,9 @@ function normalizeCodeToken(
.map((letter) => `Key${letter.toUpperCase()}`)
.join('-');
}
if (options.allowMouseButtons === true) {
if (options.allowMouseInput === true) {
const normalizedMouse = normalized.toUpperCase();
if (MPV_MOUSE_BUTTON_CODES.has(normalizedMouse)) {
if (MPV_MOUSE_CODES.has(normalizedMouse)) {
return normalizedMouse;
}
}
@@ -270,7 +274,7 @@ export function parseSessionBindingKey(
};
}
const code = normalizeCodeToken(keyToken, { allowMouseButtons: true });
const code = normalizeCodeToken(keyToken, { allowMouseInput: true });
if (!code) {
return {
key: null,