diff options
| -rw-r--r-- | modules/dashboard/Media.qml | 4 | ||||
| -rw-r--r-- | services/Cava.qml | 6 | ||||
| -rw-r--r-- | widgets/Ref.qml | 9 |
3 files changed, 18 insertions, 1 deletions
diff --git a/modules/dashboard/Media.qml b/modules/dashboard/Media.qml index 24f504a..fd36b53 100644 --- a/modules/dashboard/Media.qml +++ b/modules/dashboard/Media.qml @@ -108,6 +108,10 @@ Item { easing.bezierCurve: Appearance.anim.curves.standard } } + + Ref { + service: Cava + } } StyledClippingRect { diff --git a/services/Cava.qml b/services/Cava.qml index 3fa5083..5053984 100644 --- a/services/Cava.qml +++ b/services/Cava.qml @@ -8,12 +8,16 @@ Singleton { id: root property list<int> values + property int refCount Process { running: true command: ["sh", "-c", `printf '[general]\nframerate=60\nbars=${Config.dashboard.visualiserBars}\n[output]\nchannels=mono\nmethod=raw\nraw_target=/dev/stdout\ndata_format=ascii\nascii_max_range=100' | cava -p /dev/stdin`] stdout: SplitParser { - onRead: data => root.values = data.slice(0, -1).split(";").map(v => parseInt(v, 10)) + onRead: data => { + if (root.refCount) + root.values = data.slice(0, -1).split(";").map(v => parseInt(v, 10)); + } } } } diff --git a/widgets/Ref.qml b/widgets/Ref.qml new file mode 100644 index 0000000..679f52f --- /dev/null +++ b/widgets/Ref.qml @@ -0,0 +1,9 @@ +import Quickshell +import QtQuick + +QtObject { + required property Singleton service + + Component.onCompleted: service.refCount++ + Component.onDestruction: service.refCount-- +} |