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

Commit

Permalink
✨ Keyboard "Password Mode" - See #394
Browse files Browse the repository at this point in the history
  • Loading branch information
GitSquared committed Apr 18, 2019
1 parent 84fc7c2 commit 9c697a2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,11 @@ function registerKeyboardShortcuts() {
globalShortcut.register("CommandOrControl+Shift+H", () => {
window.fsDisp.toggleHidedotfiles();
});

// Hide on-screen keyboard visual feedback (#394)
globalShortcut.register("CommandOrControl+Shift+P", () => {
window.keyboard.togglePasswordMode();
});
}
registerKeyboardShortcuts();

Expand Down
9 changes: 7 additions & 2 deletions src/assets/css/keyboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ section#keyboard {
top: -0.925vh;
}

section#keyboard[data-password-mode="true"] {
opacity: 0.5 !important;
cursor: none !important;
}

div.keyboard_row {
display: flex;
flex-direction: row;
Expand Down Expand Up @@ -65,12 +70,12 @@ div.keyboard_key {
cursor: pointer;
}

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

div.keyboard_key.blink {
section#keyboard:not([data-password-mode="true"]) div.keyboard_key.blink {
animation-name: blink;
animation-duration: .5s;
animation-iteration-count: infinite;
Expand Down
11 changes: 11 additions & 0 deletions src/classes/keyboard.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class Keyboard {
this.container.dataset.isCtrlOn = false;
this.container.dataset.isFnOn = false;

this.container.dataset.passwordMode = false;

// Parse keymap and create DOM
Object.keys(layout).forEach(row => {
this.container.innerHTML += `<div class="keyboard_row" id="`+row+`"></div>`;
Expand Down Expand Up @@ -329,6 +331,9 @@ class Keyboard {
case "h":
window.fsDisp.toggleHidedotfiles();
return true;
case "p":
window.keyboard.togglePasswordMode();
return true;
case "\t":
let i = window.currentTerm ? window.currentTerm : 4;
if (window.term[i] && i !== window.currentTerm) {
Expand Down Expand Up @@ -533,6 +538,12 @@ class Keyboard {
document.activeElement.focus();
}
}
togglePasswordMode() {
let d = this.container.dataset.passwordMode;
(d === "true") ? d = "false" : d = "true";
this.container.dataset.passwordMode = d;
return d;
}
addCircum(char) {
switch(char) {
case "a":
Expand Down

0 comments on commit 9c697a2

Please sign in to comment.