Files
linux-dotfiles/quickshell/ui/NowPlaying.qml
2026-04-10 00:05:30 +02:00

46 lines
1.3 KiB
QML

import QtQuick
import QtQuick.Layouts
import "../constants"
Row {
id: root
property string artist: ""
property string title: ""
property string artUrl: ""
visible: title !== ""
spacing: 6
//TODO add service that reads the data from cava
// the fifo buffer is in /tmp/cava.fifo. Example data is:
// 5;3;3;3;2;1;1;3;6;18;42;16;6;6;1;1;2;6;2;3;6;6;5;11;11;12;13;66;4;4;24;2;2;24;4;4;66;13;12;11;11;5;6;6;3;2;3;2;1;1;6;6;16;42;19;5;2;1;1;2;3;4;3;7;
// where each number represents the amplitude of a frequency band.
// this can be used to create a simple visualizer
// also add cava to autostart
Canvas {
// implicitWidth: parent.implicitWidth
// implicitHeight: parent.implicitHeight
// anchors.fill: parent
}
Image {
width: 18
height: 18
source: root.artUrl
fillMode: Image.PreserveAspectCrop
anchors.verticalCenter: parent.verticalCenter
}
Text {
text: root.artist !== "" ? (root.artist + " - " + root.title) : root.title
color: Colors.md3.primary
font.family: Constants.fontFamily
font.pixelSize: Constants.fontSize
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
z: 1
}
}