add notifications
use notification blueprint from old version but improve it because its lowk retarded
This commit is contained in:
parent
70f09fc94c
commit
a4a2c89d09
14
modules/notifications/NotiServer.qml
Normal file
14
modules/notifications/NotiServer.qml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
pragma Singleton
|
||||||
|
import Quickshell.Services.Notifications
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
NotificationServer {
|
||||||
|
bodyMarkupSupported: true
|
||||||
|
persistenceSupported: true
|
||||||
|
imageSupported: true
|
||||||
|
onNotification: notification => {
|
||||||
|
notification.tracked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
123
modules/notifications/Notification.qml
Normal file
123
modules/notifications/Notification.qml
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import "."
|
||||||
|
import "../../"
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import "../../settings/"
|
||||||
|
|
||||||
|
Variants {
|
||||||
|
model: Quickshell.screens
|
||||||
|
delegate: WlrLayershell {
|
||||||
|
id: root
|
||||||
|
required property var modelData
|
||||||
|
screen: modelData
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
right: true
|
||||||
|
bottom: true
|
||||||
|
}
|
||||||
|
margins {
|
||||||
|
top: Settings.config.barHeight + 10
|
||||||
|
right: 10
|
||||||
|
left: 10
|
||||||
|
}
|
||||||
|
|
||||||
|
mask: Region { item: notifList }
|
||||||
|
implicitHeight: notifList.contentHeight + 20
|
||||||
|
implicitWidth: modelData.width / 8
|
||||||
|
|
||||||
|
layer: WlrLayer.Overlay
|
||||||
|
exclusionMode: ExclusionMode.Ignore
|
||||||
|
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: notifList
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
spacing: 10
|
||||||
|
height: contentHeight
|
||||||
|
|
||||||
|
model: NotiServer.trackedNotifications
|
||||||
|
delegate: Item {
|
||||||
|
anchors.right: parent ? parent.right : root.right
|
||||||
|
id: notifyItem
|
||||||
|
required property var index
|
||||||
|
implicitWidth: root.modelData.width / 8
|
||||||
|
implicitHeight: notiIcon.implicitHeight + 20
|
||||||
|
required property var modelData
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Colors.background
|
||||||
|
border.color: Colors.color5
|
||||||
|
border.width: 2
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: fullLayout
|
||||||
|
anchors.margins: 10
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: 10
|
||||||
|
|
||||||
|
ClippingWrapperRectangle {
|
||||||
|
id: notiIcon
|
||||||
|
radius: 0
|
||||||
|
implicitWidth: 64
|
||||||
|
implicitHeight: 64
|
||||||
|
visible: notifyItem.modelData.image !== ""
|
||||||
|
IconImage {
|
||||||
|
source: notifyItem.modelData.image
|
||||||
|
visible: notifyItem.modelData.image !== ""
|
||||||
|
implicitSize: 30
|
||||||
|
asynchronous: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: textLayout
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: notifyItem.modelData.summary
|
||||||
|
color: Colors.foreground
|
||||||
|
font.family: Settings.config.font
|
||||||
|
font.pixelSize: Settings.config.fontSize
|
||||||
|
font.bold: true
|
||||||
|
elide: Text.ElideRight
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: notifyItem.modelData.body
|
||||||
|
color: Colors.foreground
|
||||||
|
|
||||||
|
font.family: Settings.config.font
|
||||||
|
font.pixelSize: Settings.config.fontSize - 2
|
||||||
|
maximumLineCount: 3
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
elide: Text.ElideRight
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
acceptedButtons: Qt.LeftButton
|
||||||
|
onClicked: notifyItem.modelData.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
modules/notifications/qmldir
Normal file
2
modules/notifications/qmldir
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
singleton NotiServer 1.0 NotiServer.qml
|
||||||
|
Notification 1.0 Notification.qml
|
||||||
@ -5,10 +5,12 @@ import "./settings/"
|
|||||||
import "./modules/bar/"
|
import "./modules/bar/"
|
||||||
import "./modules/overlays/"
|
import "./modules/overlays/"
|
||||||
import "./modules/ipc/"
|
import "./modules/ipc/"
|
||||||
|
import "./modules/notifications/"
|
||||||
|
|
||||||
ShellRoot {
|
ShellRoot {
|
||||||
id: root
|
id: root
|
||||||
Bar {}
|
Bar {}
|
||||||
Wallpaper {}
|
Wallpaper {}
|
||||||
Ipc {}
|
Ipc {}
|
||||||
|
Notification {}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user