From 73cfcf93c8a2db4e178d2e25ee826c977513a75f Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Fri, 5 Dec 2025 00:58:36 +0100 Subject: [PATCH] fix: probe wpctl/pactl without noisy errors --- scripts/touch-gestures.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/touch-gestures.lua b/scripts/touch-gestures.lua index 54e7576..7ce2aab 100644 --- a/scripts/touch-gestures.lua +++ b/scripts/touch-gestures.lua @@ -75,17 +75,27 @@ local function run_cmd(args) return res.stdout or "" end +local function probe_cmd(args) + local res = utils.subprocess({ args = args, cancellable = false }) + if res and not res.error and res.status == 0 then + return res.stdout or "" + end + return nil +end + local function pick_volume_backend() if state.volume_backend then return state.volume_backend end - local wp = run_cmd({ config.wpctl_path, "--version" }) + local wp = probe_cmd({ config.wpctl_path, "status" }) + or probe_cmd({ config.wpctl_path, "--help" }) if wp then state.volume_backend = "wpctl" dbg("using wpctl for volume") return state.volume_backend end - local pa = run_cmd({ config.pactl_path, "--version" }) + local pa = probe_cmd({ config.pactl_path, "info" }) + or probe_cmd({ config.pactl_path, "--version" }) if pa then state.volume_backend = "pactl" dbg("using pactl for volume")