forked from Shinonome/dots-hyprland
notifications: prevent summaries from spilling
This commit is contained in:
@@ -16,6 +16,7 @@ Item { // Notification item area
|
|||||||
property bool onlyNotification: false
|
property bool onlyNotification: false
|
||||||
property real fontSize: Appearance.font.pixelSize.small
|
property real fontSize: Appearance.font.pixelSize.small
|
||||||
property real padding: onlyNotification ? 0 : 8
|
property real padding: onlyNotification ? 0 : 8
|
||||||
|
property real summaryElideRatio: 0.85
|
||||||
|
|
||||||
property real dragConfirmThreshold: 70 // Drag further to discard notification
|
property real dragConfirmThreshold: 70 // Drag further to discard notification
|
||||||
property real dismissOvershoot: notificationIcon.implicitWidth + 20 // Account for gaps and bouncy animations
|
property real dismissOvershoot: notificationIcon.implicitWidth + 20 // Account for gaps and bouncy animations
|
||||||
@@ -58,6 +59,12 @@ Item { // Notification item area
|
|||||||
destroyAnimation.running = true;
|
destroyAnimation.running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: summaryTextMetrics
|
||||||
|
font.pixelSize: root.fontSize
|
||||||
|
text: root.notificationObject.summary || ""
|
||||||
|
}
|
||||||
|
|
||||||
SequentialAnimation { // Drag finish animation
|
SequentialAnimation { // Drag finish animation
|
||||||
id: destroyAnimation
|
id: destroyAnimation
|
||||||
running: false
|
running: false
|
||||||
@@ -164,9 +171,9 @@ Item { // Notification item area
|
|||||||
visible: !root.onlyNotification || !root.expanded
|
visible: !root.onlyNotification || !root.expanded
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
implicitHeight: summaryText.implicitHeight
|
implicitHeight: summaryText.implicitHeight
|
||||||
// Layout.fillWidth: true
|
|
||||||
StyledText {
|
StyledText {
|
||||||
id: summaryText
|
id: summaryText
|
||||||
|
Layout.fillWidth: summaryTextMetrics.width >= summaryRow.width * root.summaryElideRatio
|
||||||
visible: !root.onlyNotification
|
visible: !root.onlyNotification
|
||||||
font.pixelSize: root.fontSize
|
font.pixelSize: root.fontSize
|
||||||
color: Appearance.colors.colOnLayer3
|
color: Appearance.colors.colOnLayer3
|
||||||
|
|||||||
Reference in New Issue
Block a user