mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-10 18:29:03 +00:00
Jitsi Push-to-Talk
This commit is contained in:
@@ -35,5 +35,6 @@
|
||||
"Contributing code to Matrix and Riot": "Contributing code to Matrix and Riot",
|
||||
"Dev chat for the Riot/Web dev team": "Dev chat for the Riot/Web dev team",
|
||||
"Dev chat for the Dendrite dev team": "Dev chat for the Dendrite dev team",
|
||||
"Co-ordination for Riot translators": "Co-ordination for Riot translators"
|
||||
"Co-ordination for Riot translators": "Co-ordination for Riot translators",
|
||||
"Push-to-Talk": "Push-to-Talk"
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ import rageshake from 'matrix-react-sdk/lib/rageshake/rageshake';
|
||||
|
||||
remote.autoUpdater.on('update-downloaded', onUpdateDownloaded);
|
||||
|
||||
var globalKeybindings = {};
|
||||
|
||||
// try to flush the rageshake logs to indexeddb before quit.
|
||||
ipcRenderer.on('before-quit', function () {
|
||||
console.log('riot-desktop closing');
|
||||
@@ -105,6 +107,25 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||
|
||||
this.startUpdateCheck = this.startUpdateCheck.bind(this);
|
||||
this.stopUpdateCheck = this.stopUpdateCheck.bind(this);
|
||||
|
||||
ipcRenderer.on('keybinding-pressed', (event, keybindName) => {
|
||||
// Prevent holding down a shortcut meaning multiple presses
|
||||
if (globalKeybindings[keybindName].pressed) {
|
||||
return;
|
||||
}
|
||||
globalKeybindings[keybindName].pressed = true;
|
||||
|
||||
// Run the callback
|
||||
globalKeybindings[keybindName].callback();
|
||||
});
|
||||
|
||||
ipcRenderer.on('keybinding-released', (event, keybindName) => {
|
||||
// Keybinding is no longer pressed
|
||||
globalKeybindings[keybindName].pressed = false;
|
||||
|
||||
// Run the callback
|
||||
globalKeybindings[keybindName].releaseCallback();
|
||||
});
|
||||
}
|
||||
|
||||
getHumanReadableName(): string {
|
||||
@@ -182,6 +203,26 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||
ipcRenderer.send('check_updates');
|
||||
}
|
||||
|
||||
addGlobalKeybinding(keybindName: string, keybindCode: string, callback: () => void, releaseCallback: () => void) {
|
||||
// Add a keybinding that works even when the app is minimized
|
||||
const keybinding = {name: keybindName, code: keybindCode};
|
||||
|
||||
ipcRenderer.send('register-keybinding', keybinding);
|
||||
globalKeybindings[keybindName] = {callback, releaseCallback};
|
||||
|
||||
console.warn("Adding global keybinding:", keybindName, "with code:", keybindCode);
|
||||
}
|
||||
|
||||
removeGlobalKeybinding(keybindName: string, keybindCode: string) {
|
||||
// Unbind a global keybinding
|
||||
ipcRenderer.send('unregister-keybinding', keybindCode);
|
||||
|
||||
// Remove the callback
|
||||
delete globalKeybindings[keybindName];
|
||||
|
||||
console.warn("Removing global keybinding:", keybindName);
|
||||
}
|
||||
|
||||
installUpdate() {
|
||||
// IPC to the main process to install the update, since quitAndInstall
|
||||
// doesn't fire the before-quit event so the main process needs to know
|
||||
|
||||
Reference in New Issue
Block a user