import QtQuick import QtQuick.Layouts import Quickshell PopupWindow { id: root // Calendar stays a lightweight popup owned by the bar instead of launching an // external applet. It proves Quickshell can cover Ironbar's clock surface in // the same Nugu style without adding another service. required property QtObject theme required property var barWindow required property var anchorItem property date shownDate: new Date() visible: false implicitWidth: 260 implicitHeight: 220 color: "transparent" anchor { window: root.barWindow item: root.anchorItem gravity: Edges.Bottom adjustment: PopupAdjustment.Slide } readonly property date firstOfMonth: new Date(shownDate.getFullYear(), shownDate.getMonth(), 1) readonly property int firstDay: (firstOfMonth.getDay() + 6) % 7 readonly property int daysInMonth: new Date(shownDate.getFullYear(), shownDate.getMonth() + 1, 0).getDate() readonly property int today: new Date().getDate() readonly property bool currentMonth: shownDate.getFullYear() === new Date().getFullYear() && shownDate.getMonth() === new Date().getMonth() Rectangle { anchors.fill: parent radius: 7 color: root.theme.ui.backdrop border.width: 2 border.color: root.theme.ui.accent ColumnLayout { anchors.fill: parent anchors.margins: 10 spacing: 8 Text { Layout.fillWidth: true text: Qt.formatDate(root.shownDate, "MMMM yyyy") color: root.theme.ui.important_global font.family: "IBM Plex Mono" font.pixelSize: 13 font.bold: true horizontalAlignment: Text.AlignHCenter } GridLayout { Layout.alignment: Qt.AlignHCenter columns: 7 rowSpacing: 6 columnSpacing: 6 Repeater { model: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"] Text { required property string modelData text: modelData color: root.theme.ui.minor font.family: "IBM Plex Mono" font.pixelSize: 11 horizontalAlignment: Text.AlignHCenter Layout.preferredWidth: 28 } } Repeater { model: 42 Rectangle { id: dayCell required property int index readonly property int day: index - root.firstDay + 1 readonly property bool highlighted: root.currentMonth && day === root.today Layout.preferredWidth: 28 Layout.preferredHeight: 22 radius: 5 color: highlighted ? root.theme.ui.focus : "transparent" Text { anchors.centerIn: parent text: dayCell.day >= 1 && dayCell.day <= root.daysInMonth ? dayCell.day : "" color: dayCell.highlighted ? root.theme.content.backdrop : root.theme.ui.normal font.family: "IBM Plex Mono" font.pixelSize: 11 } } } } } } }