fix ui for non-linux systems

This commit is contained in:
Oleh Polisan 2024-05-02 21:15:18 +03:00
parent cb55cf4b74
commit f695dbadab
2 changed files with 49 additions and 51 deletions

View file

@ -193,11 +193,15 @@ function StreamSettings({
); );
return ( return (
<div className="vcd-screen-picker-settings-grid"> <div className={isLinux ? "vcd-screen-picker-settings-grid" : ""}>
<div> <div>
<Forms.FormTitle>What you're streaming</Forms.FormTitle> <Forms.FormTitle>What you're streaming</Forms.FormTitle>
<Card className="vcd-screen-picker-card vcd-screen-picker-preview"> <Card className="vcd-screen-picker-card vcd-screen-picker-preview">
<img src={thumb} alt="" /> <img
src={thumb}
alt=""
className={isLinux ? "vcd-screen-picker-preview-img-linux" : "vcd-screen-picker-preview-img"}
/>
<Text variant="text-sm/normal">{source.name}</Text> <Text variant="text-sm/normal">{source.name}</Text>
</Card> </Card>
@ -283,12 +287,6 @@ function StreamSettings({
</p> </p>
</div> </div>
</div> </div>
</section>
</div>
</Card>
</div>
<div>
{isWindows && ( {isWindows && (
<Switch <Switch
value={settings.audio} value={settings.audio}
@ -299,7 +297,12 @@ function StreamSettings({
Stream With Audio Stream With Audio
</Switch> </Switch>
)} )}
</section>
</div>
</Card>
</div>
<div>
{isLinux && ( {isLinux && (
<AudioSourcePickerLinux <AudioSourcePickerLinux
audioSource={settings.audioSource} audioSource={settings.audioSource}
@ -331,13 +334,9 @@ function AudioSourcePickerLinux({
setOnlyDefaultSpeakers(b: boolean): void; setOnlyDefaultSpeakers(b: boolean): void;
}) { }) {
const [sources, _, loading] = useAwaiter(() => VesktopNative.virtmic.list(), { const [sources, _, loading] = useAwaiter(() => VesktopNative.virtmic.list(), {
fallbackValue: { ok: true, targets: [], hasPipewirePulse: true } fallbackValue: { ok: true, targets: [] }
}); });
const allSources = sources.ok ? ["None", "Entire System", ...sources.targets] : null; const allSources = sources.ok ? ["None", "Entire System", ...sources.targets] : null;
const hasPipewirePulse = sources.ok ? sources.hasPipewirePulse : true;
const [ignorePulseWarning, setIgnorePulseWarning] = useState(false);
return ( return (
<> <>
@ -349,38 +348,32 @@ function AudioSourcePickerLinux({
<Forms.FormTitle>Audio Source</Forms.FormTitle> <Forms.FormTitle>Audio Source</Forms.FormTitle>
)} )}
{!sources.ok && sources.isGlibCxxOutdated && ( {!sources.ok &&
(sources.isGlibcxxToOld ? (
<Forms.FormText> <Forms.FormText>
Failed to retrieve Audio Sources because your C++ library is too old to run Failed to retrieve Audio Sources because your C++ library is too old to run venmic. If you
<a href="https://github.com/Vencord/venmic" target="_blank"> would like to stream with Audio, see{" "}
venmic <a
</a> href="https://gist.github.com/Vendicated/b655044ffbb16b2716095a448c6d827a"
. See{" "} target="_blank"
<a href="https://gist.github.com/Vendicated/b655044ffbb16b2716095a448c6d827a" target="_blank"> >
this guide this guide
</a>{" "} </a>
for possible solutions.
</Forms.FormText> </Forms.FormText>
)} ) : (
<Forms.FormText>
Failed to retrieve Audio Sources. If you would like to stream with Audio, make sure you're
using Pipewire, not Pulseaudio
</Forms.FormText>
))}
{hasPipewirePulse || ignorePulseWarning ? ( {allSources && (
allSources && (
<Select <Select
options={allSources.map(s => ({ label: s, value: s, default: s === "None" }))} options={allSources.map(s => ({ label: s, value: s, default: s === "None" }))}
isSelected={s => s === audioSource} isSelected={s => s === audioSource}
select={setAudioSource} select={setAudioSource}
serialize={String} serialize={String}
/> />
)
) : (
<Text variant="text-sm/normal">
Could not find pipewire-pulse. This usually means that you do not run pipewire as your main
audio-server. <br />
You can still continue, however, please beware that you can only share audio of apps that are
running under pipewire.
<br />
<a onClick={() => setIgnorePulseWarning(true)}>I know what I'm doing</a>
</Text>
)} )}
<Forms.FormDivider className={Margins.top16 + " " + Margins.bottom16} /> <Forms.FormDivider className={Margins.top16 + " " + Margins.bottom16} />

View file

@ -67,11 +67,16 @@
box-sizing: border-box; box-sizing: border-box;
} }
.vcd-screen-picker-preview img { .vcd-screen-picker-preview-img-linux {
width: 100%; width: 100%;
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }
.vcd-screen-picker-preview-img {
width: 90%;
margin-bottom: 0.5em;
}
.vcd-screen-picker-preview { .vcd-screen-picker-preview {
display: flex; display: flex;
flex-direction: column; flex-direction: column;