From fac6a2a55816a146af76220f5d6784327e9c5cfd Mon Sep 17 00:00:00 2001 From: Ryan Cao <70191398+ryanccn@users.noreply.github.com> Date: Sat, 28 Oct 2023 23:43:40 +0800 Subject: [PATCH] improve UI --- src/renderer/components/ScreenSharePicker.tsx | 76 ++++++++++--------- src/renderer/components/screenSharePicker.css | 7 +- 2 files changed, 48 insertions(+), 35 deletions(-) diff --git a/src/renderer/components/ScreenSharePicker.tsx b/src/renderer/components/ScreenSharePicker.tsx index 47c0fc475..a235118aa 100644 --- a/src/renderer/components/ScreenSharePicker.tsx +++ b/src/renderer/components/ScreenSharePicker.tsx @@ -104,7 +104,8 @@ export function openScreenSharePicker(screens: Source[], skipPicker: boolean) { modalProps={props} submit={async v => { didSubmit = true; - if (v.audioSource && v.audioSource !== "None") { + + if (!v.audioDevice && v.audioSource && v.audioSource !== "None") { if (v.audioSource === "Entire System") { await VesktopNative.virtmic.startSystem(); } else { @@ -112,7 +113,7 @@ export function openScreenSharePicker(screens: Source[], skipPicker: boolean) { } } - patchAudioWithDevice(v.audioDevice); + if (v.audioDevice) patchAudioWithDevice(v.audioDevice); resolve(v); }} @@ -216,28 +217,34 @@ function StreamSettings({ - setSettings(s => ({ ...s, audioDevice: source }))} - /> - - {isWindows && ( - setSettings(s => ({ ...s, audio: checked }))} - hideBorder - className="vcd-screen-picker-audio" - > - Stream With Audio - - )} +
+ Audio - {isLinux && ( - setSettings(s => ({ ...s, audioSource: source }))} + setSettings(s => ({ ...s, audioDevice: source }))} /> - )} + + {isWindows && ( + setSettings(s => ({ ...s, audio: checked }))} + hideBorder + className="vcd-screen-picker-audio" + disabled={!!settings.audioDevice} + > + Stream with Windows loopback audio + + )} + + {isLinux && ( + setSettings(s => ({ ...s, audioSource: source }))} + disabled={!!settings.audioDevice} + /> + )} +
); @@ -248,7 +255,7 @@ function AudioSourceAnyDevice({ setAudioDevice }: { audioDevice?: string; - setAudioDevice(s: string): void; + setAudioDevice(s: string | undefined): void; }) { const [sources, _, loading] = useAwaiter( () => @@ -259,28 +266,29 @@ function AudioSourceAnyDevice({ ); return ( -
- Audio - {loading && Loading audio devices...} - + <> {sources.length > 0 && (