summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-10 19:22:53 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-10 19:34:01 +0200
commit3330683ad61be8524940c8932396a08b7062d205 (patch)
tree47ff37a32a98b0ed0077549aca70a0c2f11dda79
parent0015d26dc8a81ab17f4d84ebed3d0cce201e8e96 (diff)
downloadxK-3330683ad61be8524940c8932396a08b7062d205.tar.gz
xK-3330683ad61be8524940c8932396a08b7062d205.tar.xz
xK-3330683ad61be8524940c8932396a08b7062d205.zip
xP: handle M-a and M-! bindings from xC
-rw-r--r--xP/public/xP.js23
1 files changed, 23 insertions, 0 deletions
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()
+ }
+})