mirror of
https://github.com/Vencord/Vesktop.git
synced 2025-02-24 14:15:09 +00:00
Added ability to toggle voice using proc signals
This commit is contained in:
parent
a8d72fa665
commit
29c12dc034
5 changed files with 40 additions and 1 deletions
19
src/main/keybinds.ts
Normal file
19
src/main/keybinds.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: GPL-3.0
|
||||
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
|
||||
* Copyright (c) 2023 Vendicated and Vencord contributors
|
||||
*/
|
||||
|
||||
import { IpcEvents } from "shared/IpcEvents";
|
||||
|
||||
import { mainWin } from "./mainWindow";
|
||||
|
||||
export function initKeybinds() {
|
||||
process.on("SIGPIPE", async () => {
|
||||
mainWin.webContents.send(IpcEvents.TOGGLE_SELF_MUTE);
|
||||
});
|
||||
|
||||
process.on("SIGUSR2", () => {
|
||||
mainWin.webContents.send(IpcEvents.TOGGLE_SELF_DEAF);
|
||||
});
|
||||
}
|
|
@ -35,6 +35,7 @@ import {
|
|||
MIN_WIDTH,
|
||||
VENCORD_FILES_DIR
|
||||
} from "./constants";
|
||||
import { initKeybinds } from "./keybinds";
|
||||
import { Settings, State, VencordSettings } from "./settings";
|
||||
import { createSplashWindow } from "./splash";
|
||||
import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally";
|
||||
|
@ -481,4 +482,5 @@ export async function createWindows() {
|
|||
});
|
||||
|
||||
initArRPC();
|
||||
initKeybinds();
|
||||
}
|
||||
|
|
|
@ -78,5 +78,13 @@ export const VesktopNative = {
|
|||
clipboard: {
|
||||
copyImage: (imageBuffer: Uint8Array, imageSrc: string) =>
|
||||
invoke<void>(IpcEvents.CLIPBOARD_COPY_IMAGE, imageBuffer, imageSrc)
|
||||
},
|
||||
voice: {
|
||||
onToggleSelfMute: (listener: (...args: any[]) => void) => {
|
||||
ipcRenderer.on(IpcEvents.TOGGLE_SELF_MUTE, listener);
|
||||
},
|
||||
onToggleSelfDeaf: (listener: (...args: any[]) => void) => {
|
||||
ipcRenderer.on(IpcEvents.TOGGLE_SELF_DEAF, listener);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -57,3 +57,11 @@ VesktopNative.arrpc.onActivity(data => {
|
|||
|
||||
arRPC.handleEvent(new MessageEvent("message", { data }));
|
||||
});
|
||||
|
||||
VesktopNative.voice.onToggleSelfMute(() => {
|
||||
findByPropsLazy("toggleSelfMute").toggleSelfMute();
|
||||
});
|
||||
|
||||
VesktopNative.voice.onToggleSelfDeaf(() => {
|
||||
findByPropsLazy("toggleSelfDeaf").toggleSelfDeaf();
|
||||
});
|
||||
|
|
|
@ -49,5 +49,7 @@ export const enum IpcEvents {
|
|||
|
||||
ARRPC_ACTIVITY = "VCD_ARRPC_ACTIVITY",
|
||||
|
||||
CLIPBOARD_COPY_IMAGE = "VCD_CLIPBOARD_COPY_IMAGE"
|
||||
CLIPBOARD_COPY_IMAGE = "VCD_CLIPBOARD_COPY_IMAGE",
|
||||
TOGGLE_SELF_MUTE = "VCD_TOGGLE_SELF_MUTE",
|
||||
TOGGLE_SELF_DEAF = "VCD_TOGGLE_SELF_DEAF"
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue