Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Commit 9c697a2

Browse files
committed
✨ Keyboard "Password Mode" - See #394
1 parent 84fc7c2 commit 9c697a2

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

src/_renderer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,11 @@ function registerKeyboardShortcuts() {
860860
globalShortcut.register("CommandOrControl+Shift+H", () => {
861861
window.fsDisp.toggleHidedotfiles();
862862
});
863+
864+
// Hide on-screen keyboard visual feedback (#394)
865+
globalShortcut.register("CommandOrControl+Shift+P", () => {
866+
window.keyboard.togglePasswordMode();
867+
});
863868
}
864869
registerKeyboardShortcuts();
865870

src/assets/css/keyboard.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ section#keyboard {
77
top: -0.925vh;
88
}
99

10+
section#keyboard[data-password-mode="true"] {
11+
opacity: 0.5 !important;
12+
cursor: none !important;
13+
}
14+
1015
div.keyboard_row {
1116
display: flex;
1217
flex-direction: row;
@@ -65,12 +70,12 @@ div.keyboard_key {
6570
cursor: pointer;
6671
}
6772

68-
div.keyboard_key:active, div.keyboard_key.active {
73+
section#keyboard:not([data-password-mode="true"]) div.keyboard_key:active, section#keyboard:not([data-password-mode="true"]) div.keyboard_key.active {
6974
border: 0.18vh solid rgba(var(--color_r), var(--color_g), var(--color_b), 0.0);
7075
background-color: rgba(var(--color_r), var(--color_g), var(--color_b), 1);
7176
}
7277

73-
div.keyboard_key.blink {
78+
section#keyboard:not([data-password-mode="true"]) div.keyboard_key.blink {
7479
animation-name: blink;
7580
animation-duration: .5s;
7681
animation-iteration-count: infinite;

src/classes/keyboard.class.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class Keyboard {
2121
this.container.dataset.isCtrlOn = false;
2222
this.container.dataset.isFnOn = false;
2323

24+
this.container.dataset.passwordMode = false;
25+
2426
// Parse keymap and create DOM
2527
Object.keys(layout).forEach(row => {
2628
this.container.innerHTML += `<div class="keyboard_row" id="`+row+`"></div>`;
@@ -329,6 +331,9 @@ class Keyboard {
329331
case "h":
330332
window.fsDisp.toggleHidedotfiles();
331333
return true;
334+
case "p":
335+
window.keyboard.togglePasswordMode();
336+
return true;
332337
case "\t":
333338
let i = window.currentTerm ? window.currentTerm : 4;
334339
if (window.term[i] && i !== window.currentTerm) {
@@ -533,6 +538,12 @@ class Keyboard {
533538
document.activeElement.focus();
534539
}
535540
}
541+
togglePasswordMode() {
542+
let d = this.container.dataset.passwordMode;
543+
(d === "true") ? d = "false" : d = "true";
544+
this.container.dataset.passwordMode = d;
545+
return d;
546+
}
536547
addCircum(char) {
537548
switch(char) {
538549
case "a":

0 commit comments

Comments
 (0)