Skip to content

Commit af9cba3

Browse files
committed
allow switching off debugkeys
useful when typing passwords...
1 parent 8f6b7f5 commit af9cba3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

client/main.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ async function initGreeter(): Promise<void> {
7474
// Add reboot keybind to reboot on ctrl+alt+del
7575
// only when the lock screen is not shown
7676
document.addEventListener('keydown', (e) => {
77+
if (window.debugKeys) {
78+
window.ui.setDebugInfo(`Key pressed: ${e.code} (${e.key})${e.ctrlKey ? ' + Ctrl' : ''}${e.altKey ? ' + Alt' : ''}${e.shiftKey ? ' + Shift' : ''}${e.metaKey ? ' + Meta' : ''}`);
79+
}
7780
if (e.ctrlKey && e.altKey) { // Special keybinds
7881
switch (e.key) {
7982
case 'Delete': // Ctrl + Alt + Delete = reboot computer
@@ -85,9 +88,9 @@ async function initGreeter(): Promise<void> {
8588
window.ui.overrideExamMode();
8689
break;
8790
case 'd': // Ctrl + Alt + D = debug keys: show pressed key in debug info
88-
window.debugKeys = true;
89-
window.ui.setDebugInfo('Debug keys enabled');
90-
break;
91+
window.debugKeys = (window.debugKeys) ? false : true;
92+
window.ui.setDebugInfo(`Debug keys: ${(window.debugKeys ? 'enabled' : 'disabled')}`);
93+
return;
9194
}
9295
}
9396
else { // Regular keybinds
@@ -104,9 +107,6 @@ async function initGreeter(): Promise<void> {
104107
break;
105108
}
106109
}
107-
if (window.debugKeys) {
108-
window.ui.setDebugInfo(`Key pressed: ${e.code} (${e.key})${e.ctrlKey ? ' + Ctrl' : ''}${e.altKey ? ' + Alt' : ''}${e.shiftKey ? ' + Shift' : ''}${e.metaKey ? ' + Meta' : ''}`);
109-
}
110110
});
111111
}
112112

0 commit comments

Comments
 (0)