dashboard: optimise cava
Use refs to prevent loading at all times
This commit is contained in:
parent
45ebf3c70e
commit
c1872c2d77
3 changed files with 18 additions and 1 deletions
|
|
@ -108,6 +108,10 @@ Item {
|
|||
easing.bezierCurve: Appearance.anim.curves.standard
|
||||
}
|
||||
}
|
||||
|
||||
Ref {
|
||||
service: Cava
|
||||
}
|
||||
}
|
||||
|
||||
StyledClippingRect {
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
9
widgets/Ref.qml
Normal file
9
widgets/Ref.qml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
required property Singleton service
|
||||
|
||||
Component.onCompleted: service.refCount++
|
||||
Component.onDestruction: service.refCount--
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue