From 3330683ad61be8524940c8932396a08b7062d205 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Sat, 10 Sep 2022 19:22:53 +0200 Subject: xP: handle M-a and M-! bindings from xC --- xP/public/xP.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'xP/public') diff --git a/xP/public/xP.js b/xP/public/xP.js index 2e7732e..5f73b5f 100644 --- a/xP/public/xP.js +++ b/xP/public/xP.js @@ -614,3 +614,26 @@ let Main = { } window.addEventListener('load', () => m.mount(document.body, Main)) + +document.addEventListener('keydown', event => { + if (rpc.ws == undefined || event.ctrlKey || event.metaKey) + return + + if (event.altKey && event.key == 'a') { + for (const [name, b] of buffers) + if (name !== bufferCurrent && b.newMessages) { + rpc.send({command: 'BufferActivate', bufferName: name}) + break + } + return event.preventDefault() + } + + if (event.altKey && event.key == '!') { + for (const [name, b] of buffers) + if (name !== bufferCurrent && b.highlighted) { + rpc.send({command: 'BufferActivate', bufferName: name}) + break + } + return event.preventDefault() + } +}) -- cgit v1.2.3-70-g09d2