quickshell: wrap notifications in a card to match the other panes
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
583b0588c2
commit
d24a51b0af
1 changed files with 136 additions and 125 deletions
|
|
@ -2089,143 +2089,154 @@ in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notifications header
|
// Notifications card
|
||||||
Item {
|
Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 20
|
height: notifCardCol.height + 16
|
||||||
|
radius: 8
|
||||||
|
color: Theme.base01
|
||||||
|
|
||||||
Text {
|
Column {
|
||||||
anchors.left: parent.left
|
id: notifCardCol
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.top: parent.top
|
||||||
text: "Notifications"
|
anchors.topMargin: 8
|
||||||
color: Theme.base05
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
font.pixelSize: 13
|
|
||||||
font.weight: Font.Medium
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
text: bar.notifServer.trackedNotifications.values.length > 0 ? "Clear all" : ""
|
|
||||||
color: Theme.base04
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
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: parent.width
|
|
||||||
|
|
||||||
Text {
|
|
||||||
visible: bar.notifServer.trackedNotifications.values.length === 0
|
|
||||||
text: "No notifications"
|
|
||||||
color: Theme.base03
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
font.pixelSize: 11
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
}
|
width: parent.width - 16
|
||||||
|
spacing: 6
|
||||||
|
|
||||||
Repeater {
|
Item {
|
||||||
model: bar.notifServer.trackedNotifications
|
width: parent.width
|
||||||
|
height: 20
|
||||||
|
|
||||||
Rectangle {
|
Text {
|
||||||
id: notifItem
|
|
||||||
required property var modelData
|
|
||||||
width: calRightCol.width
|
|
||||||
height: notifCol.height + 12
|
|
||||||
radius: 6
|
|
||||||
color: Theme.base01
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: notifCol
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: dismissBtn.left
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.top: parent.top
|
text: "Notifications"
|
||||||
anchors.margins: 6
|
color: Theme.base05
|
||||||
spacing: 2
|
font.family: Theme.fontFamily
|
||||||
|
font.pixelSize: 13
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
width: parent.width
|
anchors.right: parent.right
|
||||||
text: notifItem.modelData.summary || notifItem.modelData.appName
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: Theme.base05
|
text: bar.notifServer.trackedNotifications.values.length > 0 ? "Clear all" : ""
|
||||||
font.family: Theme.fontFamily
|
color: Theme.base04
|
||||||
font.pixelSize: 11
|
font.family: Theme.fontFamily
|
||||||
font.weight: Font.Medium
|
font.pixelSize: 11
|
||||||
elide: Text.ElideRight
|
MouseArea {
|
||||||
}
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
Text {
|
onClicked: {
|
||||||
width: parent.width
|
let notifs = bar.notifServer.trackedNotifications.values;
|
||||||
text: notifItem.modelData.body || ""
|
for (let i = notifs.length - 1; i >= 0; i--) {
|
||||||
color: Theme.base04
|
notifs[i].dismiss();
|
||||||
font.family: Theme.fontFamily
|
|
||||||
font.pixelSize: 10
|
|
||||||
elide: Text.ElideRight
|
|
||||||
maximumLineCount: 2
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
visible: text !== ""
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
spacing: 4
|
|
||||||
visible: notifItem.modelData.actions.length > 0
|
|
||||||
Repeater {
|
|
||||||
model: notifItem.modelData.actions
|
|
||||||
Rectangle {
|
|
||||||
required property var modelData
|
|
||||||
width: actionText.width + 12
|
|
||||||
height: actionText.height + 4
|
|
||||||
radius: 4
|
|
||||||
color: actionMa.containsMouse ? Theme.base02 : Theme.base01
|
|
||||||
border.width: 1
|
|
||||||
border.color: Theme.base02
|
|
||||||
Text {
|
|
||||||
id: actionText
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: modelData.text
|
|
||||||
color: Theme.base05
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
font.pixelSize: 10
|
|
||||||
}
|
|
||||||
MouseArea {
|
|
||||||
id: actionMa
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: modelData.invoke()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: dismissBtn
|
visible: bar.notifServer.trackedNotifications.values.length === 0
|
||||||
anchors.right: parent.right
|
text: "No notifications"
|
||||||
anchors.top: parent.top
|
color: Theme.base03
|
||||||
anchors.margins: 6
|
font.family: Theme.fontFamily
|
||||||
text: "\u{f0156}"
|
font.pixelSize: 11
|
||||||
color: dismissMa.containsMouse ? Theme.base05 : Theme.base03
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
font.family: Theme.fontFamily
|
}
|
||||||
font.pixelSize: 12
|
|
||||||
MouseArea {
|
Repeater {
|
||||||
id: dismissMa
|
model: bar.notifServer.trackedNotifications
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
Rectangle {
|
||||||
cursorShape: Qt.PointingHandCursor
|
id: notifItem
|
||||||
onClicked: notifItem.modelData.dismiss()
|
required property var modelData
|
||||||
|
width: notifCardCol.width
|
||||||
|
height: notifCol.height + 12
|
||||||
|
radius: 6
|
||||||
|
color: Theme.base02
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: notifCol
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: dismissBtn.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.margins: 6
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
text: notifItem.modelData.summary || notifItem.modelData.appName
|
||||||
|
color: Theme.base05
|
||||||
|
font.family: Theme.fontFamily
|
||||||
|
font.pixelSize: 11
|
||||||
|
font.weight: Font.Medium
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
text: notifItem.modelData.body || ""
|
||||||
|
color: Theme.base04
|
||||||
|
font.family: Theme.fontFamily
|
||||||
|
font.pixelSize: 10
|
||||||
|
elide: Text.ElideRight
|
||||||
|
maximumLineCount: 2
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
visible: text !== ""
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
spacing: 4
|
||||||
|
visible: notifItem.modelData.actions.length > 0
|
||||||
|
Repeater {
|
||||||
|
model: notifItem.modelData.actions
|
||||||
|
Rectangle {
|
||||||
|
required property var modelData
|
||||||
|
width: actionText.width + 12
|
||||||
|
height: actionText.height + 4
|
||||||
|
radius: 4
|
||||||
|
color: actionMa.containsMouse ? Theme.base03 : Theme.base02
|
||||||
|
border.width: 1
|
||||||
|
border.color: Theme.base03
|
||||||
|
Text {
|
||||||
|
id: actionText
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: modelData.text
|
||||||
|
color: Theme.base05
|
||||||
|
font.family: Theme.fontFamily
|
||||||
|
font.pixelSize: 10
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
id: actionMa
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: modelData.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: dismissBtn
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.margins: 6
|
||||||
|
text: "\u{f0156}"
|
||||||
|
color: dismissMa.containsMouse ? Theme.base05 : Theme.base03
|
||||||
|
font.family: Theme.fontFamily
|
||||||
|
font.pixelSize: 12
|
||||||
|
MouseArea {
|
||||||
|
id: dismissMa
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: notifItem.modelData.dismiss()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue