WIP cava process

This commit is contained in:
Sem
2026-04-10 23:58:23 +02:00
parent 9f5eb82fe1
commit 7bcd3220dd
3 changed files with 45 additions and 4 deletions

View File

@@ -4,3 +4,4 @@ exec-once = /usr/bin/qs & # quickshell
exec-once = awww-daemon # wallpaper
exec-once = hyprsunset # night light
exec-once = qs -c overview # workspace switcher https://github.com/Shanu-Kumawat/quickshell-overview
exec-once = cava -p ~/.config/cava/config

View File

@@ -0,0 +1,26 @@
import QtQuick
import Quickshell
import Quickshell.Io
Item {
id: root
signal cavaDataChanged(string data)
// Process {
// id: cavaProcess
// command: ["cat", "/tmp/cava.fifo"]
// stdout: StdioCollector {
// waitForEnd: false
// onStreamFinished: {
// console.log("Cava data: " + this.text)
// root.cavaDataChanged(this.text)
// }
// }
// }
Component.onCompleted: {
cavaProcess.running = true
}
}

View File

@@ -3,13 +3,20 @@ import QtQuick
import QtQuick.Layouts
import "../constants"
import "../services"
Row {
id: root
property string artist: ""
property string title: ""
property string artUrl: ""
property int maxTextLength: 50
// if the artist - title text is too long, truncate it
readonly property string displayText: {
const fullText = artist !== "" ? (artist + " - " + title) : title
return fullText.length > maxTextLength ? fullText.substring(0, maxTextLength - 3) + "..." : fullText
}
visible: title !== ""
spacing: 6
@@ -26,6 +33,14 @@ Row {
// anchors.fill: parent
}
CavaService {
id: cavaService
onCavaDataChanged: {
// TODO update the canvas with the new data
// console.log("Cava data changed: " + data)
}
}
Image {
width: 18
height: 18
@@ -35,11 +50,10 @@ Row {
}
Text {
text: root.artist !== "" ? (root.artist + " - " + root.title) : root.title
text: root.displayText
color: Colors.md3.primary
font.family: Constants.fontFamily
font.pixelSize: Constants.fontSize
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
z: 1
}