feat: quickshell rewrite wip
This commit is contained in:
1 parent
962ae7c1c7
commit
452d7080f9
36 files changed
+677
-1685
No files matched your search
@@ -0,0 +1,81 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import "../core"
|
||||
|
||||
ModuleContainer {
|
||||
id: root
|
||||
|
||||
// Initial state
|
||||
text: "00:00"
|
||||
|
||||
Timer {
|
||||
interval: 1000
|
||||
running: true
|
||||
repeat: true
|
||||
triggeredOnStart: true
|
||||
onTriggered: {
|
||||
var d = new Date();
|
||||
var h = d.getHours().toString().padStart(2, '0');
|
||||
var m = d.getMinutes().toString().padStart(2, '0');
|
||||
root.text = h + ":" + m;
|
||||
}
|
||||
}
|
||||
|
||||
// Embed the MPRIS Popup natively into the pill's slot
|
||||
popupItem: PopupWindow {
|
||||
id: mprisPopup
|
||||
implicitWidth: 260
|
||||
implicitHeight: 80
|
||||
|
||||
anchor.item: root
|
||||
anchor.edges: Edges.Bottom
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Theme.bg
|
||||
radius: Theme.radius
|
||||
border.color: Theme.bgAlt
|
||||
border.width: 1
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.padding
|
||||
spacing: 4
|
||||
|
||||
Text {
|
||||
text: "Now Playing"
|
||||
color: Theme.fgAlt
|
||||
font: Theme.font
|
||||
}
|
||||
|
||||
Text {
|
||||
id: mprisText
|
||||
text: "Nothing playing"
|
||||
color: Theme.fg
|
||||
font: Theme.fontBold
|
||||
elide: Text.ElideRight
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: mprisProcess
|
||||
command: ["sh", "-c", "playerctl metadata --format '{{title}} - {{artist}}' || echo 'Nothing playing'"]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
mprisText.text = text.trim() || "Nothing playing";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 2000
|
||||
running: mprisPopup.visible
|
||||
repeat: true
|
||||
triggeredOnStart: true
|
||||
onTriggered: mprisProcess.running = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user