Merge branch 'main' of github.com:noctalia-dev/noctalia-shell
This commit is contained in:
commit
f06d0f4e1e
2 changed files with 133 additions and 68 deletions
|
|
@ -93,7 +93,10 @@ Variants {
|
||||||
model: notificationModel
|
model: notificationModel
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
width: 360 * scaling
|
width: 360 * scaling
|
||||||
height: Math.max(80 * scaling, contentRow.implicitHeight + (Style.marginL * 2 * scaling))
|
height: Math.max(
|
||||||
|
80 * scaling,
|
||||||
|
contentRow.implicitHeight + (actionsRow.visible ? actionsRow.implicitHeight + Style.marginM
|
||||||
|
* scaling : 0) + (Style.marginL * 2 * scaling))
|
||||||
clip: true
|
clip: true
|
||||||
radius: Style.radiusL * scaling
|
radius: Style.radiusL * scaling
|
||||||
border.color: Color.mOutline
|
border.color: Color.mOutline
|
||||||
|
|
@ -156,92 +159,148 @@ Variants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
ColumnLayout {
|
||||||
id: contentRow
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Style.marginM * scaling
|
anchors.margins: Style.marginM * scaling
|
||||||
spacing: Style.marginM * scaling
|
spacing: Style.marginM * scaling
|
||||||
|
|
||||||
// Right: header on top, then avatar + texts
|
RowLayout {
|
||||||
ColumnLayout {
|
id: contentRow
|
||||||
id: textColumn
|
spacing: Style.marginM * scaling
|
||||||
spacing: Style.marginS * scaling
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
RowLayout {
|
// Right: header on top, then avatar + texts
|
||||||
|
ColumnLayout {
|
||||||
|
id: textColumn
|
||||||
spacing: Style.marginS * scaling
|
spacing: Style.marginS * scaling
|
||||||
id: appHeaderRow
|
Layout.fillWidth: true
|
||||||
NText {
|
|
||||||
text: `${(model.appName || model.desktopEntry)
|
|
||||||
|| "Unknown App"} · ${NotificationService.formatTimestamp(model.timestamp)}`
|
|
||||||
color: Color.mSecondary
|
|
||||||
font.pointSize: Style.fontSizeXS * scaling
|
|
||||||
}
|
|
||||||
Rectangle {
|
|
||||||
width: 6 * scaling
|
|
||||||
height: 6 * scaling
|
|
||||||
radius: Style.radiusXS * scaling
|
|
||||||
color: (model.urgency === NotificationUrgency.Critical) ? Color.mError : (model.urgency === NotificationUrgency.Low) ? Color.mOnSurface : Color.mPrimary
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
}
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: bodyRow
|
|
||||||
spacing: Style.marginM * scaling
|
|
||||||
|
|
||||||
NImageCircled {
|
|
||||||
id: appAvatar
|
|
||||||
Layout.preferredWidth: 40 * scaling
|
|
||||||
Layout.preferredHeight: 40 * scaling
|
|
||||||
Layout.alignment: Qt.AlignTop
|
|
||||||
anchors.topMargin: textContent.childrenRect.y
|
|
||||||
imagePath: model.image && model.image !== "" ? model.image : ""
|
|
||||||
fallbackIcon: ""
|
|
||||||
borderColor: Color.transparent
|
|
||||||
borderWidth: 0
|
|
||||||
visible: (model.image && model.image !== "")
|
|
||||||
Layout.fillWidth: false
|
|
||||||
Layout.fillHeight: false
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: textContent
|
|
||||||
spacing: Style.marginS * scaling
|
spacing: Style.marginS * scaling
|
||||||
Layout.fillWidth: true
|
id: appHeaderRow
|
||||||
// Ensure a concrete width so text wraps
|
|
||||||
width: (textColumn.width - (appAvatar.visible ? (appAvatar.width + Style.marginM * scaling) : 0))
|
|
||||||
|
|
||||||
NText {
|
NText {
|
||||||
text: model.summary || "No summary"
|
text: `${(model.appName || model.desktopEntry)
|
||||||
font.pointSize: Style.fontSizeL * scaling
|
|| "Unknown App"} · ${NotificationService.formatTimestamp(model.timestamp)}`
|
||||||
font.weight: Style.fontWeightMedium
|
color: Color.mSecondary
|
||||||
color: Color.mOnSurface
|
font.pointSize: Style.fontSizeXS * scaling
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
}
|
||||||
|
Rectangle {
|
||||||
|
width: 6 * scaling
|
||||||
|
height: 6 * scaling
|
||||||
|
radius: Style.radiusXS * scaling
|
||||||
|
color: (model.urgency === NotificationUrgency.Critical) ? Color.mError : (model.urgency === NotificationUrgency.Low) ? Color.mOnSurface : Color.mPrimary
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
width: parent.width
|
}
|
||||||
maximumLineCount: 3
|
}
|
||||||
elide: Text.ElideRight
|
|
||||||
|
RowLayout {
|
||||||
|
id: bodyRow
|
||||||
|
spacing: Style.marginM * scaling
|
||||||
|
|
||||||
|
NImageCircled {
|
||||||
|
id: appAvatar
|
||||||
|
Layout.preferredWidth: 40 * scaling
|
||||||
|
Layout.preferredHeight: 40 * scaling
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
anchors.topMargin: textContent.childrenRect.y
|
||||||
|
imagePath: model.image && model.image !== "" ? model.image : ""
|
||||||
|
fallbackIcon: ""
|
||||||
|
borderColor: Color.transparent
|
||||||
|
borderWidth: 0
|
||||||
|
visible: (model.image && model.image !== "")
|
||||||
|
Layout.fillWidth: false
|
||||||
|
Layout.fillHeight: false
|
||||||
}
|
}
|
||||||
|
|
||||||
NText {
|
Column {
|
||||||
text: model.body || ""
|
id: textContent
|
||||||
font.pointSize: Style.fontSizeM * scaling
|
spacing: Style.marginS * scaling
|
||||||
color: Color.mOnSurface
|
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
width: parent.width
|
// Ensure a concrete width so text wraps
|
||||||
maximumLineCount: 5
|
width: (textColumn.width - (appAvatar.visible ? (appAvatar.width + Style.marginM * scaling) : 0))
|
||||||
elide: Text.ElideRight
|
|
||||||
|
NText {
|
||||||
|
text: model.summary || "No summary"
|
||||||
|
font.pointSize: Style.fontSizeL * scaling
|
||||||
|
font.weight: Style.fontWeightMedium
|
||||||
|
color: Color.mOnSurface
|
||||||
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
|
Layout.fillWidth: true
|
||||||
|
width: parent.width
|
||||||
|
maximumLineCount: 3
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
NText {
|
||||||
|
text: model.body || ""
|
||||||
|
font.pointSize: Style.fontSizeM * scaling
|
||||||
|
color: Color.mOnSurface
|
||||||
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
|
Layout.fillWidth: true
|
||||||
|
width: parent.width
|
||||||
|
maximumLineCount: 5
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions removed
|
// Notification actions - positioned below the main content
|
||||||
|
RowLayout {
|
||||||
|
id: actionsRow
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: Style.marginS * scaling
|
||||||
|
visible: model.rawNotification && model.rawNotification.actions
|
||||||
|
&& model.rawNotification.actions.length > 0
|
||||||
|
|
||||||
|
property var notificationActions: model.rawNotification ? model.rawNotification.actions : []
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
console.log("Actions row created, rawNotification:", model.rawNotification)
|
||||||
|
if (model.rawNotification) {
|
||||||
|
console.log("Actions:", model.rawNotification.actions)
|
||||||
|
console.log("Actions length:",
|
||||||
|
model.rawNotification.actions ? model.rawNotification.actions.length : "null")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: actionsRow.notificationActions
|
||||||
|
|
||||||
|
delegate: NButton {
|
||||||
|
text: {
|
||||||
|
var actionText = modelData.text || "Action"
|
||||||
|
// If text contains comma, take the part after the comma (the display text)
|
||||||
|
if (actionText.includes(",")) {
|
||||||
|
return actionText.split(",")[1] || actionText
|
||||||
|
}
|
||||||
|
return actionText
|
||||||
|
}
|
||||||
|
fontSize: Style.fontSizeS * scaling
|
||||||
|
backgroundColor: Color.mPrimary
|
||||||
|
textColor: Color.mOnPrimary
|
||||||
|
hoverColor: Color.mSecondary
|
||||||
|
pressColor: Color.mTertiary
|
||||||
|
outlined: false
|
||||||
|
customHeight: 32 * scaling
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
console.log("Action button created:", modelData.text, "Display text:", text)
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
console.log("Action clicked:", modelData.text)
|
||||||
|
if (modelData && modelData.invoke) {
|
||||||
|
modelData.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NIconButton {
|
NIconButton {
|
||||||
|
|
|
||||||
|
|
@ -265,6 +265,10 @@ The launcher supports special commands for enhanced functionality:
|
||||||
For Niri:
|
For Niri:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
debug {
|
||||||
|
honor-xdg-activation-with-invalid-serial
|
||||||
|
}
|
||||||
|
|
||||||
window-rule {
|
window-rule {
|
||||||
geometry-corner-radius 20
|
geometry-corner-radius 20
|
||||||
clip-to-geometry true
|
clip-to-geometry true
|
||||||
|
|
@ -279,6 +283,8 @@ layer-rule {
|
||||||
place-within-backdrop true
|
place-within-backdrop true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
`honor-xdg-activation-with-invalid-serial` allows notification actions (like view etc) to work.
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue