Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions src/ts/apps/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment thread
IzKuipers marked this conversation as resolved.
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() {
Expand Down
Loading