diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-28 22:29:46 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-28 22:29:46 +1000 |
| commit | c1872c2d77065a9bcfe2f7953436c561f17290a3 (patch) | |
| tree | e0fbf38929fb029c762789910f69c1b753215b9e | |
| parent | dashboard: loader panes (diff) | |
| download | caelestia-shell-c1872c2d77065a9bcfe2f7953436c561f17290a3.tar.gz caelestia-shell-c1872c2d77065a9bcfe2f7953436c561f17290a3.tar.bz2 caelestia-shell-c1872c2d77065a9bcfe2f7953436c561f17290a3.zip | |
dashboard: optimise cava
Use refs to prevent loading at all times
| -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-- +} |