WIP: Fix SourcePicker on element-desktop
This commit is contained in:
parent
01304439ee
commit
fef5168400
1 changed files with 26 additions and 1 deletions
|
@ -79,13 +79,31 @@ export default class DesktopCapturerSourcePicker extends React.Component<PickerI
|
||||||
public constructor(props: PickerIProps) {
|
public constructor(props: PickerIProps) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
if(this.isWayland()){
|
||||||
|
console.log("Running under Wayland");
|
||||||
|
}else {
|
||||||
|
console.log("Not running under Wayland");
|
||||||
|
}
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
selectedTab: Tabs.Screens,
|
selectedTab: Tabs.Screens,
|
||||||
sources: [],
|
sources: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private isWayland(): boolean {
|
||||||
|
return true;
|
||||||
|
// return process.env.XDG_SESSION_TYPE === 'wayland';
|
||||||
|
}
|
||||||
|
|
||||||
public async componentDidMount(): Promise<void> {
|
public async componentDidMount(): Promise<void> {
|
||||||
|
if (this.isWayland()) {
|
||||||
|
const sources = await getDesktopCapturerSources();
|
||||||
|
this.props.onFinished(sources[0]); // Automatically select the first source or handle accordingly
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// window.setInterval() first waits and then executes, therefore
|
// window.setInterval() first waits and then executes, therefore
|
||||||
// we call getDesktopCapturerSources() here without any delay.
|
// we call getDesktopCapturerSources() here without any delay.
|
||||||
// Otherwise the dialog would be left empty for some time.
|
// Otherwise the dialog would be left empty for some time.
|
||||||
|
@ -102,8 +120,10 @@ export default class DesktopCapturerSourcePicker extends React.Component<PickerI
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillUnmount(): void {
|
public componentWillUnmount(): void {
|
||||||
|
if (!this.isWayland()) {
|
||||||
clearInterval(this.interval);
|
clearInterval(this.interval);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private onSelect = (source: DesktopCapturerSource): void => {
|
private onSelect = (source: DesktopCapturerSource): void => {
|
||||||
this.setState({ selectedSource: source });
|
this.setState({ selectedSource: source });
|
||||||
|
@ -139,6 +159,11 @@ export default class DesktopCapturerSourcePicker extends React.Component<PickerI
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
|
if (this.isWayland()) {
|
||||||
|
return null; // Render nothing if running under Wayland
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const tabs: NonEmptyArray<Tab<Tabs>> = [
|
const tabs: NonEmptyArray<Tab<Tabs>> = [
|
||||||
this.getTab(Tabs.Screens, _td("voip|screenshare_monitor")),
|
this.getTab(Tabs.Screens, _td("voip|screenshare_monitor")),
|
||||||
this.getTab(Tabs.Windows, _td("voip|screenshare_window")),
|
this.getTab(Tabs.Windows, _td("voip|screenshare_window")),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue