stop virtmic on vc exit
This commit is contained in:
parent
bc8587bfb2
commit
baaecab523
4 changed files with 26 additions and 5 deletions
|
@ -50,4 +50,4 @@ ipcMain.handle(
|
|||
() => obtainVenmic()?.link("application.process.id", getRendererAudioServicePid(), "exclude")
|
||||
);
|
||||
|
||||
ipcMain.handle(IpcEvents.VIRT_MIC_KILL, () => obtainVenmic()?.unlink());
|
||||
ipcMain.handle(IpcEvents.VIRT_MIC_STOP, () => obtainVenmic()?.unlink());
|
||||
|
|
|
@ -64,7 +64,7 @@ export const VesktopNative = {
|
|||
list: () => invoke<string[] | null>(IpcEvents.VIRT_MIC_LIST),
|
||||
start: (target: string) => invoke<void>(IpcEvents.VIRT_MIC_START, target),
|
||||
startSystem: () => invoke<void>(IpcEvents.VIRT_MIC_START_SYSTEM),
|
||||
kill: () => invoke<void>(IpcEvents.VIRT_MIC_KILL)
|
||||
stop: () => invoke<void>(IpcEvents.VIRT_MIC_STOP)
|
||||
},
|
||||
arrpc: {
|
||||
onActivity(cb: (data: string) => void) {
|
||||
|
|
|
@ -7,8 +7,18 @@
|
|||
import "./screenSharePicker.css";
|
||||
|
||||
import { closeModal, Modals, openModal, useAwaiter } from "@vencord/types/utils";
|
||||
import { findStoreLazy } from "@vencord/types/webpack";
|
||||
import { Button, Card, Forms, Select, Switch, Text, useState } from "@vencord/types/webpack/common";
|
||||
import { findStoreLazy, onceReady } from "@vencord/types/webpack";
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
FluxDispatcher,
|
||||
Forms,
|
||||
Select,
|
||||
Switch,
|
||||
Text,
|
||||
UserStore,
|
||||
useState
|
||||
} from "@vencord/types/webpack/common";
|
||||
import type { Dispatch, SetStateAction } from "react";
|
||||
import { addPatch } from "renderer/patches/shared";
|
||||
import { isLinux, isWindows } from "renderer/utils";
|
||||
|
@ -71,6 +81,17 @@ addPatch({
|
|||
}
|
||||
});
|
||||
|
||||
if (isLinux) {
|
||||
onceReady.then(() => {
|
||||
FluxDispatcher.subscribe("VOICE_STATE_UPDATES", e => {
|
||||
for (const state of e.voiceStates) {
|
||||
if (state.userId === UserStore.getCurrentUser().id && state.oldChannelId && !state.channelId)
|
||||
VesktopNative.virtmic.stop();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function openScreenSharePicker(screens: Source[], skipPicker: boolean) {
|
||||
let didSubmit = false;
|
||||
return new Promise<StreamPick>((resolve, reject) => {
|
||||
|
|
|
@ -45,7 +45,7 @@ export const enum IpcEvents {
|
|||
VIRT_MIC_LIST = "VCD_VIRT_MIC_LIST",
|
||||
VIRT_MIC_START = "VCD_VIRT_MIC_START",
|
||||
VIRT_MIC_START_SYSTEM = "VCD_VIRT_MIC_START_ALL",
|
||||
VIRT_MIC_KILL = "VCD_VIRT_MIC_STOP",
|
||||
VIRT_MIC_STOP = "VCD_VIRT_MIC_STOP",
|
||||
|
||||
ARRPC_ACTIVITY = "VCD_ARRPC_ACTIVITY"
|
||||
}
|
||||
|
|
Reference in a new issue