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

Commit

Permalink
✨ Support keyboard shortcuts on tactile keyboard
Browse files Browse the repository at this point in the history
Also, fix previous tab shortcut
  • Loading branch information
GitSquared committed Feb 7, 2019
1 parent 0017009 commit eae3e80
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 14 deletions.
25 changes: 13 additions & 12 deletions src/_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -739,12 +739,12 @@ globalShortcut.unregisterAll();

function registerKeyboardShortcuts() {
// Open inspector
globalShortcut.register("CommandOrControl+Shift+i", () => {
globalShortcut.register("CommandOrControl+Shift+I", () => {
electron.remote.getCurrentWindow().webContents.toggleDevTools();
});

// Open settings
globalShortcut.register("CommandOrControl+Shift+s", () => {
globalShortcut.register("CommandOrControl+Shift+S", () => {
if (!document.getElementById("settingsEditor")) {
window.openSettings();
}
Expand Down Expand Up @@ -787,16 +787,17 @@ function registerKeyboardShortcuts() {
});
// Previous
globalShortcut.register("CommandOrControl+Shift+Tab", () => {
if (window.term[window.currentTerm-1]) {
window.focusShellTab(window.currentTerm-1);
} else if (window.term[window.currentTerm-2]) {
window.focusShellTab(window.currentTerm-2);
} else if (window.term[window.currentTerm-3]) {
window.focusShellTab(window.currentTerm-3);
} else if (window.term[window.currentTerm-4]) {
window.focusShellTab(window.currentTerm-4);
} else if (window.term[4]){
window.focusShellTab(4);
let i = window.currentTerm ? window.currentTerm : 4;
if (window.term[i] && i !== window.currentTerm) {
window.focusShellTab(i);
} else if (window.term[i-1]) {
window.focusShellTab(i-1);
} else if (window.term[i-2]) {
window.focusShellTab(i-2);
} else if (window.term[i-3]) {
window.focusShellTab(i-3);
} else if (window.term[i-3]) {
window.focusShellTab(i-3);
}
});
// By tab number
Expand Down
47 changes: 45 additions & 2 deletions src/classes/keyboard.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,53 @@ class Keyboard {
} else {
// Do nothing, return not accepted in inputs
}
} else if (cmd === this.ctrlseq[19] && window.keyboard.linkedToTerm && window.term[window.currentTerm].term.hasSelection()) {
} else if (this.container.dataset.isCtrlOn && this.container.dataset.isShiftOn && cmd === "C") {
window.term[window.currentTerm].clipboard.copy();
} else if (cmd === this.ctrlseq[20] && window.keyboard.linkedToTerm && window.term[window.currentTerm].clipboard.didCopy) {
} else if (this.container.dataset.isCtrlOn && this.container.dataset.isShiftOn && cmd === "V") {
window.term[window.currentTerm].clipboard.paste();
} else if (this.container.dataset.isCtrlOn && this.container.dataset.isShiftOn && cmd === "S") {
if (!document.getElementById("settingsEditor")) {
window.openSettings();
}
} else if (this.container.dataset.isCtrlOn && this.container.dataset.isShiftOn && cmd === "I") {
electron.remote.getCurrentWindow().webContents.toggleDevTools();
} else if (this.container.dataset.isCtrlOn && this.container.dataset.isShiftOn && cmd === "H") {
window.fsDisp.toggleHidedotfiles();
} else if (this.container.dataset.isCtrlOn && this.container.dataset.isShiftOn && cmd === "\t") {
let i = window.currentTerm ? window.currentTerm : 4;
if (window.term[i] && i !== window.currentTerm) {
window.focusShellTab(i);
} else if (window.term[i-1]) {
window.focusShellTab(i-1);
} else if (window.term[i-2]) {
window.focusShellTab(i-2);
} else if (window.term[i-3]) {
window.focusShellTab(i-3);
} else if (window.term[i-3]) {
window.focusShellTab(i-3);
}
} else if (this.container.dataset.isCtrlOn && cmd === "\t") {
if (window.term[window.currentTerm+1]) {
window.focusShellTab(window.currentTerm+1);
} else if (window.term[window.currentTerm+2]) {
window.focusShellTab(window.currentTerm+2);
} else if (window.term[window.currentTerm+3]) {
window.focusShellTab(window.currentTerm+3);
} else if (window.term[window.currentTerm+4]) {
window.focusShellTab(window.currentTerm+4);
} else {
window.focusShellTab(0);
}
} else if (this.container.dataset.isCtrlOn && cmd === "1") {
window.focusShellTab(0);
} else if (this.container.dataset.isCtrlOn && cmd === "2") {
window.focusShellTab(1);
} else if (this.container.dataset.isCtrlOn && cmd === "3") {
window.focusShellTab(2);
} else if (this.container.dataset.isCtrlOn && cmd === "4") {
window.focusShellTab(3);
} else if (this.container.dataset.isCtrlOn && cmd === "5") {
window.focusShellTab(4);
} else {
if (window.keyboard.linkedToTerm) {
window.term[window.currentTerm].write(cmd);
Expand Down

0 comments on commit eae3e80

Please # to comment.