Add alt+shift variants to keyboard shortcuts in case alt+control conflicts with existing shortcuts.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
# shellcheck shell=bash disable=SC2034,SC2154
|
||||
|
||||
pkgname=skald-git
|
||||
pkgver=0.0.0.r1539.g4f35f4b
|
||||
pkgver=0.0.0.r1540.g26c7808
|
||||
pkgrel=1
|
||||
pkgdesc='Audio-only hall-based conferencing server'
|
||||
arch=('x86_64' 'aarch64')
|
||||
|
||||
+13
-9
@@ -3152,9 +3152,9 @@ commands.help = {
|
||||
cs.push(`/${cmd}${c.parameters?' ' + c.parameters:''}: ${c.description}`);
|
||||
}
|
||||
let shortcuts = '\n\nKeyboard shortcuts:\n' +
|
||||
'Control+Alt+H: Raise or lower hand\n' +
|
||||
'Control+Alt+C: Expand or collapse chat\n' +
|
||||
'Control+Alt+T: Mute or unmute microphone';
|
||||
'Control+Alt+H or Alt+Shift+H: Raise or lower hand\n' +
|
||||
'Control+Alt+C or Alt+Shift+C: Expand or collapse chat\n' +
|
||||
'Control+Alt+T or Alt+Shift+T: Mute or unmute microphone';
|
||||
localMessage(cs.sort().join('\n') + shortcuts);
|
||||
}
|
||||
};
|
||||
@@ -4173,10 +4173,14 @@ async function start() {
|
||||
setViewportHeight();
|
||||
}
|
||||
|
||||
function isGlobalShortcut(e, key) {
|
||||
return e.altKey && (e.ctrlKey || e.shiftKey) && e.key.toLowerCase() === key;
|
||||
}
|
||||
|
||||
// Global keyboard shortcuts
|
||||
document.addEventListener('keydown', function(e) {
|
||||
// Control+Alt+H - Raise or lower hand
|
||||
if(e.ctrlKey && e.altKey && e.key.toLowerCase() === 'h') {
|
||||
// Control+Alt+H or Alt+Shift+H - Raise or lower hand
|
||||
if(isGlobalShortcut(e, 'h')) {
|
||||
e.preventDefault();
|
||||
if(!serverConnection || !serverConnection.id) {
|
||||
return;
|
||||
@@ -4201,8 +4205,8 @@ document.addEventListener('keydown', function(e) {
|
||||
}, 100);
|
||||
}
|
||||
|
||||
// Control+Alt+C - Expand or collapse chat
|
||||
if(e.ctrlKey && e.altKey && e.key.toLowerCase() === 'c') {
|
||||
// Control+Alt+C or Alt+Shift+C - Expand or collapse chat
|
||||
if(isGlobalShortcut(e, 'c')) {
|
||||
e.preventDefault();
|
||||
|
||||
let leftPanel = document.getElementById('left');
|
||||
@@ -4250,8 +4254,8 @@ document.addEventListener('keydown', function(e) {
|
||||
}
|
||||
}
|
||||
|
||||
// Control+Alt+T - Mute or unmute microphone
|
||||
if(e.ctrlKey && e.altKey && e.key.toLowerCase() === 't') {
|
||||
// Control+Alt+T or Alt+Shift+T - Mute or unmute microphone
|
||||
if(isGlobalShortcut(e, 't')) {
|
||||
e.preventDefault();
|
||||
let muteButton = document.getElementById('mutebutton');
|
||||
if(!muteButton) {
|
||||
|
||||
@@ -72,3 +72,16 @@ func TestHallHeadingIncludesCurrentStatus(t *testing.T) {
|
||||
requireFunctionContains(t, js, "gotUserMessage", "hallRecording = true")
|
||||
requireFunctionContains(t, js, "gotUserMessage", "hallRecording = false")
|
||||
}
|
||||
|
||||
func TestGlobalShortcutAliasesStayDocumented(t *testing.T) {
|
||||
js := readStaticFile(t, "skald.js")
|
||||
|
||||
requireFunctionContains(t, js, "isGlobalShortcut", "e.altKey && (e.ctrlKey || e.shiftKey)")
|
||||
requireFunctionContains(t, js, "isGlobalShortcut", "e.key.toLowerCase() === key")
|
||||
requireContains(t, js, "Control+Alt+H or Alt+Shift+H: Raise or lower hand", "shortcut help")
|
||||
requireContains(t, js, "Control+Alt+C or Alt+Shift+C: Expand or collapse chat", "shortcut help")
|
||||
requireContains(t, js, "Control+Alt+T or Alt+Shift+T: Mute or unmute microphone", "shortcut help")
|
||||
requireContains(t, js, "if(isGlobalShortcut(e, 'h'))", "hand shortcut")
|
||||
requireContains(t, js, "if(isGlobalShortcut(e, 'c'))", "chat shortcut")
|
||||
requireContains(t, js, "if(isGlobalShortcut(e, 't'))", "microphone shortcut")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user