From 812904262323b4a02bdb24fd710270b9fd421845 Mon Sep 17 00:00:00 2001 From: Killswitch Date: Fri, 30 Apr 2021 21:41:52 +0200 Subject: [PATCH] Detect if pipewire is present --- src/backends/audio.ts | 13 ++++++++++--- src/mod.ts | 10 ++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/backends/audio.ts b/src/backends/audio.ts index 0ff1935..bcbf985 100644 --- a/src/backends/audio.ts +++ b/src/backends/audio.ts @@ -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(); @@ -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(); + } }); } diff --git a/src/mod.ts b/src/mod.ts index 1284b99..0644493 100755 --- a/src/mod.ts +++ b/src/mod.ts @@ -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");