From 4414b863c7d17d37c49716622281a35a68b88dc1 Mon Sep 17 00:00:00 2001 From: bbedward Date: Sun, 17 Aug 2025 17:51:20 -0400 Subject: [PATCH] Ensure cava only runs when media is playing --- Modules/TopBar/AudioVisualization.qml | 9 +++++++-- Services/CavaService.qml | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Modules/TopBar/AudioVisualization.qml b/Modules/TopBar/AudioVisualization.qml index e2a5562e..7668fda9 100644 --- a/Modules/TopBar/AudioVisualization.qml +++ b/Modules/TopBar/AudioVisualization.qml @@ -14,8 +14,13 @@ Item { width: 20 height: Theme.iconSize - Ref { - service: CavaService + Loader { + active: isPlaying + sourceComponent: Component { + Ref { + service: CavaService + } + } } Timer { diff --git a/Services/CavaService.qml b/Services/CavaService.qml index 9d916750..9f2557f2 100644 --- a/Services/CavaService.qml +++ b/Services/CavaService.qml @@ -17,12 +17,16 @@ Singleton { id: cavaCheck command: ["which", "cava"] - running: true + running: false onExited: exitCode => { root.cavaAvailable = exitCode === 0 } } + Component.onCompleted: { + cavaCheck.running = true + } + Process { id: cavaProcess