quickshell: wrap calendar+notifications in parent container
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6e69f86f17
commit
179b44d319
1 changed files with 157 additions and 138 deletions
|
|
@ -1873,167 +1873,184 @@ in
|
|||
}
|
||||
|
||||
Rectangle {
|
||||
width: 7 * 32 + 16
|
||||
height: calTitle.height + 16
|
||||
radius: 8
|
||||
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
|
||||
width: 7 * 32 + 24
|
||||
height: calWrapCol.height + 16
|
||||
radius: 10
|
||||
color: Theme.base01
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Column {
|
||||
id: calInner
|
||||
anchors.centerIn: parent
|
||||
spacing: 4
|
||||
id: calWrapCol
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 8
|
||||
spacing: 8
|
||||
|
||||
Rectangle {
|
||||
width: 7 * 32
|
||||
height: weekdayRow.height + 8
|
||||
radius: 6
|
||||
width: 7 * 32 + 8
|
||||
height: calTitle.height + 12
|
||||
radius: 8
|
||||
color: Theme.base02
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Row {
|
||||
id: weekdayRow
|
||||
Text {
|
||||
id: calTitle
|
||||
anchors.centerIn: parent
|
||||
spacing: 0
|
||||
Repeater {
|
||||
model: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"]
|
||||
Text {
|
||||
required property var modelData
|
||||
width: 32
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: modelData
|
||||
color: Theme.base03
|
||||
font.family: "FiraMono Nerd Font"
|
||||
font.pixelSize: 13
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
Grid {
|
||||
columns: 7
|
||||
spacing: 0
|
||||
Rectangle {
|
||||
width: 7 * 32 + 8
|
||||
height: calInner.height + 12
|
||||
radius: 8
|
||||
color: Theme.base02
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Repeater {
|
||||
id: calRepeater
|
||||
model: 42
|
||||
Column {
|
||||
id: calInner
|
||||
anchors.centerIn: parent
|
||||
spacing: 4
|
||||
|
||||
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.base02 : "transparent";
|
||||
}
|
||||
width: 7 * 32
|
||||
height: weekdayRow.height + 8
|
||||
radius: 6
|
||||
color: Theme.base03
|
||||
|
||||
Text {
|
||||
Row {
|
||||
id: weekdayRow
|
||||
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() : "";
|
||||
spacing: 0
|
||||
Repeater {
|
||||
model: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"]
|
||||
Text {
|
||||
required property var modelData
|
||||
width: 32
|
||||
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;
|
||||
let dayNum = parent.index - startDay + 1;
|
||||
return (dayNum === d.getDate()) ? Theme.base05 : Theme.base04;
|
||||
}
|
||||
}
|
||||
|
||||
Grid {
|
||||
columns: 7
|
||||
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 {
|
||||
id: notifItem
|
||||
required property var modelData
|
||||
width: 7 * 32 + 16
|
||||
height: notifCol.height + 12
|
||||
radius: 6
|
||||
color: Theme.base01
|
||||
width: 7 * 32 + 8
|
||||
height: 1
|
||||
color: Theme.base02
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
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 {
|
||||
id: notifCol
|
||||
|
|
@ -2075,9 +2092,9 @@ in
|
|||
width: actionText.width + 12
|
||||
height: actionText.height + 4
|
||||
radius: 4
|
||||
color: actionMa.containsMouse ? Theme.base02 : Theme.base01
|
||||
color: actionMa.containsMouse ? Theme.base03 : Theme.base02
|
||||
border.width: 1
|
||||
border.color: Theme.base02
|
||||
border.color: Theme.base03
|
||||
Text {
|
||||
id: actionText
|
||||
anchors.centerIn: parent
|
||||
|
|
@ -2118,6 +2135,8 @@ in
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue