mirror of
https://github.com/MeexReay/poshlostios.git
synced 2025-06-24 10:32:59 +03:00
fix keybinds
This commit is contained in:
parent
7c76fa25ed
commit
655d83aa5f
@ -65,27 +65,31 @@ function moveWindowToTop(wid) {
|
|||||||
window.mxwm_windows = windows
|
window.mxwm_windows = windows
|
||||||
}
|
}
|
||||||
|
|
||||||
let altKey = false
|
let pressedKeys = []
|
||||||
let shiftKey = false
|
|
||||||
let ctrlKey = false
|
function isPressed(key) {
|
||||||
|
return pressedKeys.indexOf(key) !== -1
|
||||||
|
}
|
||||||
|
|
||||||
async function onKeyDown(ctx, key) {
|
async function onKeyDown(ctx, key) {
|
||||||
if (key == "Control") ctrlKey = true
|
if (pressedKeys.indexOf(key) === -1) {
|
||||||
if (key == "Alt") altKey = true
|
pressedKeys.push(key)
|
||||||
if (key == "Shift") shiftKey = true
|
}
|
||||||
|
|
||||||
if (altKey && shiftKey && key == "Q") {
|
console.log(pressedKeys)
|
||||||
|
|
||||||
|
if ((isPressed("Alt") || isPressed("Meta")) && isPressed("Shift") && isPressed("Q")) {
|
||||||
disableGraphics()
|
disableGraphics()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (altKey && shiftKey && key == "C") {
|
if ((isPressed("Alt") || isPressed("Meta")) && isPressed("Shift") && isPressed("C")) {
|
||||||
signalWindow(selected_window, 9)
|
signalWindow(selected_window, 9)
|
||||||
closeWindow(selected_window)
|
closeWindow(selected_window)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (altKey && key == "Enter") {
|
if ((isPressed("Alt") || isPressed("Meta")) && pressedKeys.indexOf("Enter") !== -1) {
|
||||||
executeCommand(["/app/zterm.js"])
|
executeCommand(["/app/zterm.js"])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -94,9 +98,12 @@ async function onKeyDown(ctx, key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onKeyUp(ctx, key) {
|
async function onKeyUp(ctx, key) {
|
||||||
if (key == "Control") ctrlKey = false
|
let index = pressedKeys.indexOf(key)
|
||||||
if (key == "Alt") altKey = false
|
if (index !== -1) {
|
||||||
if (key == "Shift") shiftKey = false
|
pressedKeys.splice(index, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(pressedKeys)
|
||||||
|
|
||||||
if (selected_window != null) getWindow(selected_window).onkeyup(key)
|
if (selected_window != null) getWindow(selected_window).onkeyup(key)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user