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 } } } }