Compare commits
2 commits
6e6135c53b
...
41b75cffca
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41b75cffca | ||
|
|
12e1d64660 |
3 changed files with 49 additions and 30 deletions
40
modules/bar/components/notifications/NotificationItem.qml
Normal file
40
modules/bar/components/notifications/NotificationItem.qml
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import qs.widgets
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Widgets
|
||||||
|
|
||||||
|
StyledLabel {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property var modelData
|
||||||
|
|
||||||
|
margin: 16
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
ClippingRectangle {
|
||||||
|
implicitWidth: icon.implicitSize
|
||||||
|
implicitHeight: icon.implicitSize
|
||||||
|
IconImage {
|
||||||
|
id: icon
|
||||||
|
implicitSize: 20
|
||||||
|
source: root.modelData.image == "" ? Quickshell.iconPath(root.modelData.appIcon, "device-support-unknown-symbolic") : root.modelData.image
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ColumnLayout {
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
font.bold: true
|
||||||
|
font.pixelSize: 12
|
||||||
|
text: root.modelData.summary ?? root.modelData.appName
|
||||||
|
}
|
||||||
|
StyledText {
|
||||||
|
text: root.modelData.body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -61,34 +61,7 @@ StyledPopupWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model: Notifications.list
|
model: Notifications.list
|
||||||
delegate: StyledLabel {
|
delegate: NotificationItem {}
|
||||||
required property var modelData
|
|
||||||
margin: 16
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
RowLayout {
|
|
||||||
ClippingRectangle {
|
|
||||||
implicitWidth: icon.implicitSize
|
|
||||||
implicitHeight: icon.implicitSize
|
|
||||||
IconImage {
|
|
||||||
id: icon
|
|
||||||
implicitSize: 20
|
|
||||||
source: modelData.image == "" ? Quickshell.iconPath(modelData.appIcon, "device-support-unknown-symbolic") : modelData.image
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ColumnLayout {
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
font.bold: true
|
|
||||||
font.pixelSize: 12
|
|
||||||
text: modelData.summary ?? modelData.appName
|
|
||||||
}
|
|
||||||
StyledText {
|
|
||||||
text: modelData.body
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Services.Notifications
|
import Quickshell.Services.Notifications
|
||||||
|
|
||||||
|
|
@ -31,9 +32,14 @@ Singleton {
|
||||||
if (!root.enabled) {
|
if (!root.enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event == null) {
|
||||||
|
console.log("Event is null?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
event.tracked = true;
|
event.tracked = true;
|
||||||
root.list = root.list.filter(item => item.id != event.id);
|
root.list = root.list.filter(item => item != null && item.id != event.id).push(event);
|
||||||
root.list.push(event);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue