quickshell: wrap calendar+notifications in parent container

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-27 11:26:34 +01:00
parent 6e69f86f17
commit 179b44d319

View file

@ -1873,167 +1873,184 @@ in
} }
Rectangle { Rectangle {
width: 7 * 32 + 16 width: 7 * 32 + 24
height: calTitle.height + 16 height: calWrapCol.height + 16
radius: 8 radius: 10
color: Theme.base01
anchors.horizontalCenter: parent.horizontalCenter
Text {
id: calTitle
anchors.centerIn: parent
text: clockText.now.toLocaleDateString(Qt.locale(), "dddd, d MMMM yyyy")
color: Theme.base05
font.family: "FiraMono Nerd Font"
font.pixelSize: 16
font.weight: Font.Medium
}
}
Rectangle {
width: 7 * 32 + 16
height: calInner.height + 16
radius: 8
color: Theme.base01 color: Theme.base01
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
Column { Column {
id: calInner id: calWrapCol
anchors.centerIn: parent anchors.horizontalCenter: parent.horizontalCenter
spacing: 4 anchors.top: parent.top
anchors.topMargin: 8
spacing: 8
Rectangle { Rectangle {
width: 7 * 32 width: 7 * 32 + 8
height: weekdayRow.height + 8 height: calTitle.height + 12
radius: 6 radius: 8
color: Theme.base02 color: Theme.base02
anchors.horizontalCenter: parent.horizontalCenter
Row { Text {
id: weekdayRow id: calTitle
anchors.centerIn: parent anchors.centerIn: parent
spacing: 0 text: clockText.now.toLocaleDateString(Qt.locale(), "dddd, d MMMM yyyy")
Repeater { color: Theme.base05
model: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"] font.family: "FiraMono Nerd Font"
Text { font.pixelSize: 16
required property var modelData font.weight: Font.Medium
width: 32
horizontalAlignment: Text.AlignHCenter
text: modelData
color: Theme.base03
font.family: "FiraMono Nerd Font"
font.pixelSize: 13
}
}
} }
} }
Grid { Rectangle {
columns: 7 width: 7 * 32 + 8
spacing: 0 height: calInner.height + 12
radius: 8
color: Theme.base02
anchors.horizontalCenter: parent.horizontalCenter
Repeater { Column {
id: calRepeater id: calInner
model: 42 anchors.centerIn: parent
spacing: 4
Rectangle { Rectangle {
required property int index width: 7 * 32
width: 32 height: weekdayRow.height + 8
height: 26 radius: 6
radius: 4 color: Theme.base03
color: {
let d = clockText.now;
let first = new Date(d.getFullYear(), d.getMonth(), 1);
let startDay = (first.getDay() + 6) % 7;
let dayNum = index - startDay + 1;
let daysInMonth = new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate();
return (dayNum === d.getDate() && dayNum >= 1 && dayNum <= daysInMonth)
? Theme.base02 : "transparent";
}
Text { Row {
id: weekdayRow
anchors.centerIn: parent anchors.centerIn: parent
text: { spacing: 0
let d = clockText.now; Repeater {
let first = new Date(d.getFullYear(), d.getMonth(), 1); model: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"]
let startDay = (first.getDay() + 6) % 7; Text {
let dayNum = parent.index - startDay + 1; required property var modelData
let daysInMonth = new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate(); width: 32
return (dayNum >= 1 && dayNum <= daysInMonth) ? dayNum.toString() : ""; horizontalAlignment: Text.AlignHCenter
text: modelData
color: Theme.base00
font.family: "FiraMono Nerd Font"
font.pixelSize: 13
}
} }
color: { }
let d = clockText.now; }
let first = new Date(d.getFullYear(), d.getMonth(), 1);
let startDay = (first.getDay() + 6) % 7; Grid {
let dayNum = parent.index - startDay + 1; columns: 7
return (dayNum === d.getDate()) ? Theme.base05 : Theme.base04; spacing: 0
Repeater {
id: calRepeater
model: 42
Rectangle {
required property int index
width: 32
height: 26
radius: 4
color: {
let d = clockText.now;
let first = new Date(d.getFullYear(), d.getMonth(), 1);
let startDay = (first.getDay() + 6) % 7;
let dayNum = index - startDay + 1;
let daysInMonth = new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate();
return (dayNum === d.getDate() && dayNum >= 1 && dayNum <= daysInMonth)
? Theme.base03 : "transparent";
}
Text {
anchors.centerIn: parent
text: {
let d = clockText.now;
let first = new Date(d.getFullYear(), d.getMonth(), 1);
let startDay = (first.getDay() + 6) % 7;
let dayNum = parent.index - startDay + 1;
let daysInMonth = new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate();
return (dayNum >= 1 && dayNum <= daysInMonth) ? dayNum.toString() : "";
}
color: {
let d = clockText.now;
let first = new Date(d.getFullYear(), d.getMonth(), 1);
let startDay = (first.getDay() + 6) % 7;
let dayNum = parent.index - startDay + 1;
return (dayNum === d.getDate()) ? Theme.base05 : Theme.base04;
}
font.family: "FiraMono Nerd Font"
font.pixelSize: 13
}
} }
font.family: "FiraMono Nerd Font"
font.pixelSize: 13
} }
} }
} }
} }
}
}
Rectangle {
width: 7 * 32 + 16
height: 1
color: Theme.base02
}
Row {
width: 7 * 32 + 16
Text {
text: "Notifications"
color: Theme.base05
font.family: "FiraMono Nerd Font"
font.pixelSize: 13
font.weight: Font.Medium
}
Item { Layout.fillWidth: true; width: 10 }
Text {
anchors.right: parent.right
text: bar.notifServer.trackedNotifications.values.length > 0 ? "Clear all" : ""
color: Theme.base04
font.family: "FiraMono Nerd Font"
font.pixelSize: 11
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
let notifs = bar.notifServer.trackedNotifications.values;
for (let i = notifs.length - 1; i >= 0; i--) {
notifs[i].dismiss();
}
}
}
}
}
Column {
spacing: 4
width: 7 * 32 + 16
Text {
visible: bar.notifServer.trackedNotifications.values.length === 0
text: "No notifications"
color: Theme.base03
font.family: "FiraMono Nerd Font"
font.pixelSize: 11
anchors.horizontalCenter: parent.horizontalCenter
}
Repeater {
model: bar.notifServer.trackedNotifications
Rectangle { Rectangle {
id: notifItem width: 7 * 32 + 8
required property var modelData height: 1
width: 7 * 32 + 16 color: Theme.base02
height: notifCol.height + 12 anchors.horizontalCenter: parent.horizontalCenter
radius: 6 }
color: Theme.base01
Row {
width: 7 * 32 + 8
anchors.horizontalCenter: parent.horizontalCenter
Text {
text: "Notifications"
color: Theme.base05
font.family: "FiraMono Nerd Font"
font.pixelSize: 13
font.weight: Font.Medium
}
Item { Layout.fillWidth: true; width: 10 }
Text {
anchors.right: parent.right
text: bar.notifServer.trackedNotifications.values.length > 0 ? "Clear all" : ""
color: Theme.base04
font.family: "FiraMono Nerd Font"
font.pixelSize: 11
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
let notifs = bar.notifServer.trackedNotifications.values;
for (let i = notifs.length - 1; i >= 0; i--) {
notifs[i].dismiss();
}
}
}
}
}
Column {
spacing: 4
width: 7 * 32 + 8
anchors.horizontalCenter: parent.horizontalCenter
Text {
visible: bar.notifServer.trackedNotifications.values.length === 0
text: "No notifications"
color: Theme.base03
font.family: "FiraMono Nerd Font"
font.pixelSize: 11
anchors.horizontalCenter: parent.horizontalCenter
}
Repeater {
model: bar.notifServer.trackedNotifications
Rectangle {
id: notifItem
required property var modelData
width: 7 * 32 + 8
height: notifCol.height + 12
radius: 6
color: Theme.base02
Column { Column {
id: notifCol id: notifCol
@ -2075,9 +2092,9 @@ in
width: actionText.width + 12 width: actionText.width + 12
height: actionText.height + 4 height: actionText.height + 4
radius: 4 radius: 4
color: actionMa.containsMouse ? Theme.base02 : Theme.base01 color: actionMa.containsMouse ? Theme.base03 : Theme.base02
border.width: 1 border.width: 1
border.color: Theme.base02 border.color: Theme.base03
Text { Text {
id: actionText id: actionText
anchors.centerIn: parent anchors.centerIn: parent
@ -2118,6 +2135,8 @@ in
} }
} }
} }
}
}
} }
} }
} }