diff --git a/packages/remote-input/src/backends/waylandYdotool.test.ts b/packages/remote-input/src/backends/waylandYdotool.test.ts index b60c842..32268ad 100644 --- a/packages/remote-input/src/backends/waylandYdotool.test.ts +++ b/packages/remote-input/src/backends/waylandYdotool.test.ts @@ -124,6 +124,34 @@ describe('WaylandYdotoolInputBackend', () => { expect(run).toHaveBeenCalledWith('ydotool', ['type', 'a']); }); + it('uses the detected ydotool binary for text input', async () => { + const run = vi.fn().mockResolvedValue(undefined); + const backend = new WaylandYdotoolInputBackend(run, { + hasBinary: true, + binaryPath: '/opt/pairux/ydotool', + hasSocket: true, + socketPath: '/tmp/.ydotool_socket', + }); + + await backend.inject({ + type: 'keyboard', + action: 'press', + key: 'a', + code: 'KeyA', + modifiers: { ctrl: false, alt: false, shift: false, meta: false }, + }); + await backend.inject({ + type: 'keyboard', + action: 'press', + key: '🙂', + code: 'Unidentified', + modifiers: { ctrl: false, alt: false, shift: false, meta: false }, + }); + + expect(run).toHaveBeenNthCalledWith(1, '/opt/pairux/ydotool', ['type', 'a']); + expect(run).toHaveBeenNthCalledWith(2, '/opt/pairux/ydotool', ['type', '🙂']); + }); + it('emits key sequence for modified shortcut', async () => { const run = vi.fn().mockResolvedValue(undefined); const backend = new WaylandYdotoolInputBackend(run, { diff --git a/packages/remote-input/src/backends/waylandYdotool.ts b/packages/remote-input/src/backends/waylandYdotool.ts index 19a3355..90327c7 100644 --- a/packages/remote-input/src/backends/waylandYdotool.ts +++ b/packages/remote-input/src/backends/waylandYdotool.ts @@ -565,13 +565,13 @@ export class WaylandYdotoolInputBackend implements InputBackend { const modifiers = modifierKeycodes(event.modifiers); if (event.action === 'press' && modifiers.length === 0 && event.key.length === 1) { - await this.run('ydotool', ['type', event.key]); + await this.run(this.ydotoolCommand, ['type', event.key]); return; } if (keycode == null) { if (event.action === 'press' && event.key.length > 0) { - await this.run('ydotool', ['type', event.key]); + await this.run(this.ydotoolCommand, ['type', event.key]); return; } throw new Error(`Unsupported key for ydotool backend: ${event.key} (${event.code})`);