blob: 0ef8712b4b4340db4c084d6e3b8dfe22ca2759e0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Quickshell
import Quickshell.Wayland
import Quickshell.Services.Notifications
PanelWindow {
// required property font custom_font
required property color text_color
property list<QtObject> notification_objects
width: 500
height: 600
color: "#171a18"
WlrLayershell.layer: WlrLayer.Overlay
Rectangle {
border.width: 5
border.color: "#8ec07c"
anchors.fill: parent
color: "transparent"
ColumnLayout {
id: content
anchors {
left: parent.left
leftMargin: 10
right: parent.right
rightMargin: 10
top: parent.top
topMargin: 10
}
RowLayout {
Layout.fillWidth: true
Text {
Layout.fillWidth: true
text: "Notifications:"
// font: custom_font
color: text_color
}
Text {
text: "clear"
// font: custom_font
color: text_color
TapHandler {
id: tapHandler
gesturePolicy: TapHandler.ReleaseWithinBounds
onTapped: {
server.trackedNotifications.values.forEach((notification) => {
notification.tracked = false
})
notification_objects.forEach((object) => {
object.destroy();
})
notification_objects = [];
}
}
HoverHandler {
id: mouse
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
cursorShape: Qt.PointingHandCursor
}
}
}
}
}
NotificationServer {
id: server
onNotification: (notification) => {
notification.tracked = true
console.log(JSON.stringify(notification));
var notification_component = Qt.createComponent("Notification.qml");
var notification_object = notification_component
.createObject(content,
{
id: notification.id,
body: notification.body,
summary: notification.summary,
// font: custom_font,
color: text_color,
margin: 10
}
)
if (notification_object == null) {
console.log("Error creating notification")
} else {
notification_objects.push(notification_object);
}
}
}
}
|