Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Detect if pipewire is present #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/backends/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ let createdModules: Number[] = [];
export default async function (options: Options, logger: Logger) {
// TODO: Detect already created modules

// Detect if pipewire is currently active
let sinks = await getSinks();
if(sinks.length > 0 && sinks[0].module == "PipeWire") {
logger.panic("PipeWire not supported.");
}

let apps = await getUserSelectedApplications();
let sources = await getUserSelectedSources();

Expand Down Expand Up @@ -78,9 +84,10 @@ export default async function (options: Options, logger: Logger) {
});
resolve(sinks);
}

logger.panic(`An error occured while trying to list the sinks`, cmd.status.code);
reject();
else {
logger.panic(`An error occured while trying to list the sinks`, cmd.status.code);
reject();
}
});
}

Expand Down
10 changes: 10 additions & 0 deletions src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ if (!options.wayland) {
.catch(() => null);
}

if (options.sound) {
await exec("pipewire --version", { output: 3 })
.then((cmd) => {
if (cmd.status.success) {
logger.warn("PipeWire is not currently supported. You can use catia to do the routing yourself.");
}
})
.catch(() => null);
}

if (options.sound) await startSound(options, logger);
if (options.wayland) {
logger.info("Wayland detected, to use X11 add -x");
Expand Down