Made notification panel scrollable
This commit is contained in:
@@ -8,104 +8,101 @@ import qs.common
|
|||||||
import qs.common.widgets
|
import qs.common.widgets
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
required property Notification notif
|
required property Notification notif
|
||||||
required property real textWidth
|
required property real textWidth
|
||||||
required property real notificationRounding
|
required property real notificationRounding
|
||||||
property real spacing: 8
|
property real spacing: 8
|
||||||
|
|
||||||
Layout.fillWidth: true
|
implicitWidth: textWidth
|
||||||
|
implicitHeight: content.implicitHeight
|
||||||
implicitHeight: content.implicitHeight
|
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
ColumnLayout {
|
id: content
|
||||||
id: content
|
spacing: 0
|
||||||
Layout.fillWidth: true
|
Rectangle {
|
||||||
spacing: 0
|
implicitHeight: appTitle.implicitHeight
|
||||||
Rectangle {
|
implicitWidth: root.width
|
||||||
implicitHeight: appTitle.implicitHeight
|
anchors.margins: Config.options.bar.cornerStyle === 1 ? (Appearance.sizes.hyprlandGapsOut) : 0
|
||||||
implicitWidth: root.width
|
color: Appearance.m3colors.m3primaryContainer
|
||||||
anchors.margins: Config.options.bar.cornerStyle === 1 ? (Appearance.sizes.hyprlandGapsOut) : 0
|
topLeftRadius: root.notificationRounding
|
||||||
color: Appearance.m3colors.m3primaryContainer
|
topRightRadius: root.notificationRounding
|
||||||
topLeftRadius: root.notificationRounding
|
RowLayout {
|
||||||
topRightRadius: root.notificationRounding
|
spacing: 0 // For some reason, adding a spacing of just the value will not work properly
|
||||||
RowLayout {
|
IconImage {
|
||||||
spacing: 0 // For some reason, adding a spacing of just the value will not work properly
|
id: appIcon
|
||||||
IconImage {
|
visible: root.notif.appIcon.length > 0
|
||||||
visible: root.notif.appIcon.length > 0
|
source: Quickshell.iconPath(root.notif.appIcon)
|
||||||
id: appIcon
|
width: appTitle.height - root.spacing
|
||||||
source: Quickshell.iconPath(root.notif.appIcon)
|
height: appTitle.height - root.spacing
|
||||||
width: appTitle.height - root.spacing
|
Layout.leftMargin: root.spacing / 2
|
||||||
height: appTitle.height - root.spacing
|
}
|
||||||
Layout.leftMargin: root.spacing / 2
|
Text {
|
||||||
}
|
// app title
|
||||||
Text {
|
id: appTitle
|
||||||
// app title
|
text: root.notif.appName
|
||||||
id: appTitle
|
color: Appearance.m3colors.m3onPrimaryContainer
|
||||||
text: root.notif.appName
|
Layout.leftMargin: root.spacing / 2
|
||||||
color: Appearance.m3colors.m3onPrimaryContainer
|
}
|
||||||
Layout.leftMargin: root.spacing / 2
|
}
|
||||||
}
|
}
|
||||||
}
|
Rectangle {
|
||||||
}
|
visible: notifSummary.visible || notifBody.visible
|
||||||
Rectangle {
|
implicitHeight: body.implicitHeight
|
||||||
visible: notifSummary.visible || notifBody.visible
|
implicitWidth: root.width
|
||||||
implicitHeight: body.implicitHeight
|
anchors.margins: Config.options.bar.cornerStyle === 1 ? (Appearance.sizes.hyprlandGapsOut) : 0
|
||||||
implicitWidth: root.width
|
color: Appearance.colors.colLayer2
|
||||||
anchors.margins: Config.options.bar.cornerStyle === 1 ? (Appearance.sizes.hyprlandGapsOut) : 0
|
bottomLeftRadius: root.notificationRounding
|
||||||
color: Appearance.colors.colLayer2
|
bottomRightRadius: root.notificationRounding
|
||||||
bottomLeftRadius: root.notificationRounding
|
ColumnLayout {
|
||||||
bottomRightRadius: root.notificationRounding
|
id: body
|
||||||
ColumnLayout {
|
spacing: root.spacing
|
||||||
id: body
|
Text {
|
||||||
spacing: root.spacing
|
id: notifSummary
|
||||||
Text {
|
visible: root.notif.summary.length > 0
|
||||||
visible: root.notif.summary.length > 0
|
Layout.leftMargin: root.spacing
|
||||||
Layout.leftMargin: root.spacing
|
Layout.rightMargin: root.spacing
|
||||||
Layout.rightMargin: root.spacing
|
text: root.notif.summary
|
||||||
id: notifSummary
|
color: Appearance.colors.colOnLayer2
|
||||||
text: root.notif.summary
|
wrapMode: Text.WordWrap
|
||||||
color: Appearance.colors.colOnLayer2
|
}
|
||||||
wrapMode: Text.WordWrap
|
Text {
|
||||||
}
|
id: notifBody
|
||||||
Text {
|
visible: root.notif.body.length > 0
|
||||||
visible: root.notif.body.length > 0
|
Layout.leftMargin: root.spacing
|
||||||
Layout.leftMargin: root.spacing
|
Layout.rightMargin: root.spacing
|
||||||
Layout.rightMargin: root.spacing
|
Layout.preferredWidth: textWidth
|
||||||
Layout.preferredWidth: textWidth
|
text: root.notif.body
|
||||||
id: notifBody
|
color: Appearance.colors.colOnLayer2
|
||||||
text: root.notif.body
|
wrapMode: Text.WordWrap
|
||||||
color: Appearance.colors.colOnLayer2
|
maximumLineCount: 4
|
||||||
wrapMode: Text.WordWrap
|
}
|
||||||
maximumLineCount: 4
|
RowLayout {
|
||||||
}
|
id: actionLayer
|
||||||
RowLayout {
|
Layout.fillWidth: true
|
||||||
id: actionLayer
|
Layout.leftMargin: root.spacing
|
||||||
Layout.fillWidth: true
|
Layout.rightMargin: root.spacing
|
||||||
Layout.leftMargin: root.spacing
|
Layout.bottomMargin: root.spacing
|
||||||
Layout.rightMargin: root.spacing
|
spacing: root.spacing
|
||||||
Layout.bottomMargin: root.spacing
|
RippleButton {
|
||||||
spacing: root.spacing
|
buttonText: "Dismiss"
|
||||||
RippleButton {
|
colBackground: Appearance.m3colors.m3primaryContainer
|
||||||
buttonText: "Dismiss"
|
releaseAction: root.notif.dismiss
|
||||||
colBackground: Appearance.m3colors.m3primaryContainer
|
buttonRadius: root.notificationRounding
|
||||||
releaseAction: root.notif.dismiss
|
}
|
||||||
buttonRadius: root.notificationRounding
|
|
||||||
}
|
Repeater {
|
||||||
|
model: root.notif.actions
|
||||||
Repeater {
|
RippleButton {
|
||||||
model: root.notif.actions
|
buttonText: modelData.text
|
||||||
RippleButton {
|
buttonTextColor: Appearance.m3colors.m3onTertiaryContainer
|
||||||
buttonText: modelData.text
|
colBackground: Appearance.m3colors.m3tertiaryContainer
|
||||||
buttonTextColor: Appearance.m3colors.m3onTertiaryContainer
|
releaseAction: modelData.invoke
|
||||||
colBackground: Appearance.m3colors.m3tertiaryContainer
|
buttonRadius: root.notificationRounding
|
||||||
releaseAction: modelData.invoke
|
}
|
||||||
buttonRadius: root.notificationRounding
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -64,32 +64,27 @@ Scope {
|
|||||||
hideTimer.stop();
|
hideTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ListView {
|
||||||
id: notifs
|
id: notifs
|
||||||
|
anchors.fill: parent
|
||||||
anchors.margins: 4
|
anchors.margins: 4
|
||||||
Layout.fillWidth: true
|
clip: true
|
||||||
anchors.left: parent.left
|
spacing: 4
|
||||||
anchors.right: parent.right
|
model: NotificationService.notifications
|
||||||
visible: NotificationService.amountNotifications > 0
|
header: RippleButton {
|
||||||
|
|
||||||
// Dismiss All Button
|
|
||||||
RippleButton {
|
|
||||||
buttonText: "Dismiss All"
|
buttonText: "Dismiss All"
|
||||||
buttonTextColor: Appearance.m3colors.m3onTertiaryContainer
|
buttonTextColor: Appearance.m3colors.m3onTertiaryContainer
|
||||||
colBackground: Appearance.m3colors.m3tertiaryContainer
|
colBackground: Appearance.m3colors.m3tertiaryContainer
|
||||||
releaseAction: NotificationService.dismissAll
|
releaseAction: NotificationService.dismissAll
|
||||||
buttonRadius: Appearance.rounding.unsharpenmore
|
buttonRadius: Appearance.rounding.unsharpenmore
|
||||||
Layout.fillWidth: true
|
width: notifs.width - 8
|
||||||
}
|
}
|
||||||
|
delegate: NotificationItem {
|
||||||
Repeater {
|
required property Notification modelData
|
||||||
model: NotificationService.notifications
|
notif: modelData
|
||||||
NotificationItem {
|
textWidth: notifs.width - 8
|
||||||
required property Notification modelData
|
notificationRounding: Appearance.rounding.unsharpenmore
|
||||||
notif: modelData
|
Layout.fillWidth: true
|
||||||
textWidth: root.panelWidth - 14
|
|
||||||
notificationRounding: Appearance.rounding.unsharpenmore
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user