Compare commits

..
3 changed files with 66 additions and 27 deletions
+2 -2
View File
@@ -16,7 +16,7 @@ PanelWindow {
anchors.left: true anchors.left: true
// implicitHeight: screen.height/6 // implicitHeight: screen.height/6
implicitHeight: contentHeight+(content.spacing*(notificationListModel.count-1)) implicitHeight: Math.max(contentHeight+(content.spacing*(notificationListModel.count-1)), 0)
implicitWidth: contentWidth implicitWidth: contentWidth
@@ -68,7 +68,7 @@ PanelWindow {
const summary = notification.summary const summary = notification.summary
if (dismiss) { if (dismiss) {
Config.debug == "Notification" && console.log("[NotificationWindow " + Hyprland.monitorFor(screen).activeWorkspace.id + "]: Dissmiss: " + appName + " " + id + " - " + summary) Config.debug == "Notification" && console.log("[NotificationWindow " + Hyprland.monitorFor(screen).activeWorkspace.id + "]: Dissmiss: " + appName + " " + id + " - " + summary)
notification.dismiss() if (notification.tracked) {notification.dismiss()}
notificationListModel.remove(index) notificationListModel.remove(index)
} else { } else {
Config.debug == "Notification" && console.log("[NotificationWindow " + Hyprland.monitorFor(screen).activeWorkspace.id + "]: Close: " + appName + " " + id + " - " + summary) Config.debug == "Notification" && console.log("[NotificationWindow " + Hyprland.monitorFor(screen).activeWorkspace.id + "]: Close: " + appName + " " + id + " - " + summary)
+63 -24
View File
@@ -15,17 +15,17 @@ Rectangle {
property bool closing: false property bool closing: false
property real duration: ( notification.hasInlineReply ? 5000000000 : 1) property real duration: (
// notification.expireTimeout > 0 ? notification.expireTimeout : notification.expireTimeout > 0 ? notification.expireTimeout*1000 :
// urgency ? urgency * 2000 : urgency ? urgency * 2000 :
// 5000 5000
// ) )
signal dismissed(var notification, bool dismiss) signal dismissed(var notification, bool dismiss)
implicitWidth: screen.width/7 implicitWidth: screen.width/7
// implicitHeight: screen.height/7 // implicitHeight: screen.height/7
implicitHeight: contentRowRectangle.height+(notification.actions.length>0?actionRowRectangle.height:0)+(notification.hasInlineReply?inlineReplyRectangle.height:0)+progressBar.height implicitHeight: contentRowRectangle.height+(actionRowRectangle.visible?actionRowRectangle.height:0)+(inlineReplyRectangle.visible?inlineReplyRectangle.height:0)+(progressBar.visible?progressBar.height:0)
color: textBGColor color: textBGColor
border.width: Config.border_width border.width: Config.border_width
@@ -42,12 +42,20 @@ Rectangle {
root.dismissed(root.notification, dismiss) root.dismissed(root.notification, dismiss)
} }
Connections {
target: root.notification
function onClosed(reason){
// It is known that it can be triggered twice and delete multiple Index but since it is only temporary display and the chance is low it is ignored
root.closeNotification(false)
}
}
MouseArea { MouseArea {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onClicked: { onClicked: {
root.closeNotification(true) root.closeNotification(false)
} }
} }
Column { Column {
@@ -62,11 +70,47 @@ Rectangle {
color: "transparent" color: "transparent"
border.width: Config.border_width border.width: Config.border_width
border.color: textColor border.color: textColor
MouseArea {
id: closingMouseArea
anchors.top: parent.top
anchors.right: parent.right
anchors.margins: Config.spacing
width: closeIconText.implicitHeight + Config.spacing
height: closeIconText.implicitHeight + Config.spacing
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
Rectangle {
anchors.fill: parent
radius: Config.radius
color: parent.containsMouse ? Colors.errorContainer : "transparent"
border.width: Config.border_width
border.color: parent.containsMouse ? Colors.error : textColor
Text {
id: closeIconText
anchors.centerIn: parent
text: "✕"; // or "✕"
font.family: Config.font
font.pixelSize: Config.screen_height_to_font_small(screen.height)
color: parent.parent.containsMouse ? Colors.error_fg : textColor
}
}
onClicked: function(mouse){
mouse.accepted=true
root.closeNotification(true)
}
}
Row { Row {
id: contentRow id: contentRow
anchors.fill: parent anchors.fill: parent
anchors.margins: 10 anchors.margins: 10
spacing: Config.spacing*4 spacing: Config.spacing*4
width: parent.width
// Left side: icon + icon information // Left side: icon + icon information
Rectangle{ Rectangle{
@@ -77,7 +121,7 @@ Rectangle {
Column { Column {
id: iconColumn id: iconColumn
// height: Math.max(childrenRect.height, contentBodyColumn.height) // height: Math.max(childrenRect.height, contentBodyColumn.height)
width: 1.25*128 width: 1.25*iconImage.width
spacing: Config.spacing spacing: Config.spacing
Image { Image {
@@ -121,6 +165,7 @@ Rectangle {
width: childrenRect.width width: childrenRect.width
height: childrenRect.height height: childrenRect.height
color: "transparent" color: "transparent"
Column { Column {
id: contentBodyColumn id: contentBodyColumn
width: root.width - iconColumn.width width: root.width - iconColumn.width
@@ -199,13 +244,11 @@ Rectangle {
} }
} }
onClicked: { onClicked: function(mouse){
mouse.accepted=true
modelData.invoke() modelData.invoke()
if (!notification.resident) { // resident check is allready in .invoke()
root.closeNotification(true) root.closeNotification(false)
} else {
root.closeNotification(false)
}
} }
} }
} }
@@ -222,16 +265,10 @@ Rectangle {
visible: notification.hasInlineReply visible: notification.hasInlineReply
function sendReply(message) { function sendReply(message) {
console.log("BEFORE sendInlineReply", notification.id, notification.resident)
notification.sendInlineReply(message) notification.sendInlineReply(message)
inlineReplyTextField.focus = false inlineReplyTextField.focus = false
console.log("AFTER sendInlineReply", notification.id) // resident check is allready in .invoke()
root.closeNotification(false)
if (!notification.resident) {
root.closeNotification(true)
} else {
root.closeNotification(false)
}
} }
Row { Row {
@@ -289,7 +326,8 @@ Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
} }
} }
onClicked: { onClicked: function(mouse){
mouse.accepted=true;
console.log("[NotificationBodyInlineReply]: Pressed SEND:", inlineReplyTextField.text) console.log("[NotificationBodyInlineReply]: Pressed SEND:", inlineReplyTextField.text)
inlineReplyRectangle.sendReply(inlineReplyTextField.text) inlineReplyRectangle.sendReply(inlineReplyTextField.text)
} }
@@ -304,6 +342,7 @@ Rectangle {
// anchors.left: parent.left // anchors.left: parent.left
height: Config.screen_height_to_font_tiny(screen.height) height: Config.screen_height_to_font_tiny(screen.height)
color: textColor color: textColor
visible: root.duration > 0
property real progress: 1.0 property real progress: 1.0
width: parent.width * progress width: parent.width * progress
@@ -314,7 +353,7 @@ Rectangle {
from: 1.0 from: 1.0
to: 0.0 to: 0.0
duration: root.duration duration: root.duration
paused: mouseArea.containsMouse paused: mouseArea.containsMouse || closingMouseArea.containsMouse || inlineReplyButtonMouseArea.containsMouse
onFinished: root.closeNotification(false) onFinished: root.closeNotification(false)
} }
@@ -86,7 +86,7 @@ Item {
notificationSound.play() notificationSound.play()
} }
// destroy() destroy()
} }
} }
} }