mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-31 00:42:50 -05:00
cava: pass config via stdin
This commit is contained in:
@@ -11,7 +11,6 @@ Item {
|
|||||||
property bool hasActiveMedia: false
|
property bool hasActiveMedia: false
|
||||||
property var activePlayer: null
|
property var activePlayer: null
|
||||||
property bool cavaAvailable: false
|
property bool cavaAvailable: false
|
||||||
property bool configCreated: false
|
|
||||||
|
|
||||||
width: 20
|
width: 20
|
||||||
height: Theme.iconSize
|
height: Theme.iconSize
|
||||||
@@ -22,53 +21,20 @@ Item {
|
|||||||
running: true
|
running: true
|
||||||
onExited: (exitCode) => {
|
onExited: (exitCode) => {
|
||||||
root.cavaAvailable = exitCode === 0
|
root.cavaAvailable = exitCode === 0
|
||||||
if (root.cavaAvailable && !root.configCreated) {
|
if (root.cavaAvailable) {
|
||||||
console.log("cava found - creating config and enabling real audio visualization")
|
console.log("cava found - enabling real audio visualization")
|
||||||
configWriter.running = true
|
cavaProcess.running = Qt.binding(() => root.hasActiveMedia && root.activePlayer?.playbackState === MprisPlaybackState.Playing)
|
||||||
} else if (!root.cavaAvailable) {
|
} else {
|
||||||
console.log("cava not found - using fallback animation")
|
console.log("cava not found - using fallback animation")
|
||||||
fallbackTimer.running = Qt.binding(() => root.hasActiveMedia && root.activePlayer?.playbackState === MprisPlaybackState.Playing)
|
fallbackTimer.running = Qt.binding(() => root.hasActiveMedia && root.activePlayer?.playbackState === MprisPlaybackState.Playing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
|
||||||
id: configWriter
|
|
||||||
running: false
|
|
||||||
command: [
|
|
||||||
"sh", "-c",
|
|
||||||
`cat > /tmp/quickshell_cava_config << 'EOF'
|
|
||||||
[general]
|
|
||||||
mode = normal
|
|
||||||
framerate = 30
|
|
||||||
autosens = 0
|
|
||||||
sensitivity = 50
|
|
||||||
bars = 4
|
|
||||||
|
|
||||||
[output]
|
|
||||||
method = raw
|
|
||||||
raw_target = /dev/stdout
|
|
||||||
data_format = ascii
|
|
||||||
channels = mono
|
|
||||||
mono_option = average
|
|
||||||
|
|
||||||
[smoothing]
|
|
||||||
noise_reduction = 20
|
|
||||||
EOF`
|
|
||||||
]
|
|
||||||
|
|
||||||
onExited: {
|
|
||||||
root.configCreated = true
|
|
||||||
if (root.cavaAvailable) {
|
|
||||||
cavaProcess.running = Qt.binding(() => root.hasActiveMedia && root.activePlayer?.playbackState === MprisPlaybackState.Playing)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: cavaProcess
|
id: cavaProcess
|
||||||
running: false
|
running: false
|
||||||
command: ["cava", "-p", "/tmp/quickshell_cava_config"]
|
command: ["sh", "-c", `printf '[general]\nmode=normal\nframerate=30\nautosens=0\nsensitivity=50\nbars=4\n[output]\nmethod=raw\nraw_target=/dev/stdout\ndata_format=ascii\nchannels=mono\nmono_option=average\n[smoothing]\nnoise_reduction=20' | cava -p /dev/stdin`]
|
||||||
|
|
||||||
stdout: SplitParser {
|
stdout: SplitParser {
|
||||||
splitMarker: "\n"
|
splitMarker: "\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user