added a lil' fella
This commit is contained in:
@@ -20,14 +20,23 @@ Item {
|
|||||||
root.artist = "";
|
root.artist = "";
|
||||||
root.title = "";
|
root.title = "";
|
||||||
root.artUrl = "";
|
root.artUrl = "";
|
||||||
root.isPlaying = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var parts = text.split("|||");
|
var parts = text.split("|||");
|
||||||
root.artist = parts[0] || "";
|
root.artist = parts[0] || "";
|
||||||
root.title = parts[1] || "";
|
root.title = parts[1] || "";
|
||||||
root.artUrl = parts[2] || "";
|
root.artUrl = parts[2] || "";
|
||||||
root.isPlaying = (parts[3] || "").trim() === "Playing";
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: playerCtlPlayingProc
|
||||||
|
command: ["playerctl", "status"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
var status = this.text.trim();
|
||||||
|
root.isPlaying = (status === "Playing");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,5 +48,12 @@ Item {
|
|||||||
onTriggered: playerctlProc.running = true
|
onTriggered: playerctlProc.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 1000
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
onTriggered: playerCtlPlayingProc.running = true
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: playerctlProc.running = true
|
Component.onCompleted: playerctlProc.running = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ ShellRoot {
|
|||||||
nowPlayingArtist: nowPlayingService.artist
|
nowPlayingArtist: nowPlayingService.artist
|
||||||
nowPlayingTitle: nowPlayingService.title
|
nowPlayingTitle: nowPlayingService.title
|
||||||
nowPlayingArtUrl: nowPlayingService.artUrl
|
nowPlayingArtUrl: nowPlayingService.artUrl
|
||||||
|
nowPlaying: nowPlayingService.isPlaying
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ Row {
|
|||||||
property string artist: ""
|
property string artist: ""
|
||||||
property string title: ""
|
property string title: ""
|
||||||
property string artUrl: ""
|
property string artUrl: ""
|
||||||
|
property bool isPlaying: false
|
||||||
property int maxTextLength: 50
|
property int maxTextLength: 50
|
||||||
|
|
||||||
property int numBands: 32
|
property int numBands: 32
|
||||||
@@ -20,9 +21,20 @@ Row {
|
|||||||
return fullText.length > maxTextLength ? fullText.substring(0, maxTextLength - 3) + "..." : fullText;
|
return fullText.length > maxTextLength ? fullText.substring(0, maxTextLength - 3) + "..." : fullText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property string dancingLeft: "└(ಠ_ಠ )┐"
|
||||||
|
property string dancingRight: "┌( ಠ_ಠ)┘"
|
||||||
|
property string notDancing: "(ಠ ∩ ಠ)"
|
||||||
|
|
||||||
visible: title !== ""
|
visible: title !== ""
|
||||||
spacing: 6
|
spacing: 6
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: littleFella
|
||||||
|
text: root.dancingLeft
|
||||||
|
color: Colors.md3.primary
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
//TODO add service that reads the data from cava
|
//TODO add service that reads the data from cava
|
||||||
// the fifo buffer is in /tmp/cava.fifo. Example data is:
|
// 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;
|
// 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;
|
||||||
@@ -47,11 +59,24 @@ Row {
|
|||||||
// z: 1
|
// z: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Timer {
|
||||||
id: titleArea
|
interval: 400
|
||||||
anchors.bottom: parent.bottom
|
running: true
|
||||||
width: titleText.implicitWidth
|
repeat: true
|
||||||
height: Math.max(titleText.implicitHeight, visualizer.height)
|
onTriggered: {
|
||||||
|
if (root.isPlaying) {
|
||||||
|
littleFella.text = littleFella.text === root.dancingLeft ? root.dancingRight : root.dancingLeft;
|
||||||
|
} else {
|
||||||
|
littleFella.text = root.notDancing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Item {
|
||||||
|
// id: titleArea
|
||||||
|
// anchors.bottom: parent.bottom
|
||||||
|
// width: titleText.implicitWidth
|
||||||
|
// height: Math.max(titleText.implicitHeight, visualizer.height)
|
||||||
|
|
||||||
// Canvas {
|
// Canvas {
|
||||||
// id: visualizer
|
// id: visualizer
|
||||||
@@ -133,7 +158,7 @@ Row {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// CavaService {
|
// CavaService {
|
||||||
// id: cavaService
|
// id: cavaService
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ Item {
|
|||||||
property string nowPlayingArtist: ""
|
property string nowPlayingArtist: ""
|
||||||
property string nowPlayingTitle: ""
|
property string nowPlayingTitle: ""
|
||||||
property string nowPlayingArtUrl: ""
|
property string nowPlayingArtUrl: ""
|
||||||
|
property bool nowPlaying: false
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -44,6 +45,7 @@ Item {
|
|||||||
artist: root.nowPlayingArtist
|
artist: root.nowPlayingArtist
|
||||||
title: root.nowPlayingTitle
|
title: root.nowPlayingTitle
|
||||||
artUrl: root.nowPlayingArtUrl
|
artUrl: root.nowPlayingArtUrl
|
||||||
|
isPlaying: root.nowPlaying
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.alignment: Qt.AlignBottom
|
Layout.alignment: Qt.AlignBottom
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user