diff --git a/src/ts/apps/process.ts b/src/ts/apps/process.ts index f1b57303..7fb75a15 100755 --- a/src/ts/apps/process.ts +++ b/src/ts/apps/process.ts @@ -330,25 +330,24 @@ export class AppProcess extends Process implements IAppProcess { if (state != "desktop" || this._disposed) return; - for (const combo of this.acceleratorStore) { - const alt = combo.alt ? e.altKey : true; - const ctrl = combo.ctrl ? e.ctrlKey : true; - const shift = combo.shift ? e.shiftKey : true; - /** */ - const modifiers = alt && ctrl && shift; - /** */ - const pK = e.key.toLowerCase().trim(); - const key = combo.key?.trim().toLowerCase(); - const codedKey = String.fromCharCode(e.keyCode).toLowerCase(); - /** */ - const isFocused = Stack.renderer?.focusedPid() == this.pid || combo.global; - - if (!modifiers || (key != pK && key && key != codedKey) || !isFocused) continue; - - if (!Daemon?.elevation!._elevating) await combo.action(this, e); - - break; - } + const combo = this.acceleratorStore.find((combo) => { + const ctrl = combo.ctrl ? e.ctrlKey : e.ctrlKey === false; + const shift = combo.shift ? e.shiftKey : e.shiftKey === false; + const alt = combo.alt ? e.altKey : e.altKey === false; + + const comboKey = combo.key?.trim().toLowerCase(); + const pressedKey = e.key.toLowerCase().trim(); + const codedKey = e.code.toLowerCase(); + + if (!ctrl || !shift || !alt || (pressedKey != comboKey && codedKey != comboKey)) return false; + return true; + }); + + const isFocused = Stack.renderer?.focusedPid() == this.pid || combo?.global; + + if (!combo || !isFocused) return; + + if (!Daemon?.elevation!._elevating) await combo.action(this, e); } public unfocusActiveElement() {