Initial Notification Daemon Impl
This commit is contained in:
40
NotificationsWidget.qml
Normal file
40
NotificationsWidget.qml
Normal file
@@ -0,0 +1,40 @@
|
||||
import QtQuick
|
||||
import Quickshell.Widgets
|
||||
import qs.Services
|
||||
import qs.Common
|
||||
import Quickshell.Services.Notifications
|
||||
|
||||
Item {
|
||||
property var monitor: ""
|
||||
|
||||
MarginWrapperManager {
|
||||
rightMargin: Theme.gaps
|
||||
leftMargin: Theme.gaps
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: Theme.backgroudColor
|
||||
implicitWidth: clockText.implicitWidth * 1.6
|
||||
implicitHeight: Theme.heightGaps //root.implicitHeight*0.8
|
||||
radius: 25
|
||||
|
||||
Text {
|
||||
id: clockText
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: "OPA!"
|
||||
font.bold: true
|
||||
font.pixelSize: 14
|
||||
font.family: Theme.fontFamily
|
||||
color: Theme.textColor
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
console.log(Notifications.tracked)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
28
Services/Notifications.qml
Normal file
28
Services/Notifications.qml
Normal file
@@ -0,0 +1,28 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.Notifications
|
||||
|
||||
Singleton {
|
||||
id: notificationsRoot
|
||||
|
||||
NotificationServer {
|
||||
id: nServer
|
||||
imageSupported: true
|
||||
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onNotification(rapazinho) {
|
||||
console.log(rapazinho.id)
|
||||
console.log(nServer.trackedNotifications)
|
||||
}
|
||||
|
||||
target: nServer
|
||||
}
|
||||
|
||||
property var tracked: nServer.trackedNotifications
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
@@ -8,7 +10,7 @@ import qs.Common
|
||||
|
||||
WrapperRectangle {
|
||||
id: systrayRoot
|
||||
property var monitor: ""
|
||||
property string monitor: ""
|
||||
rightMargin: Theme.gaps
|
||||
leftMargin: Theme.gaps
|
||||
radius: 25
|
||||
@@ -17,13 +19,16 @@ WrapperRectangle {
|
||||
|
||||
// color: Theme.backgroudColor
|
||||
RowLayout {
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||
property var monitor: parent.monitor
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||
Repeater {
|
||||
property string monitor: parent.monitor
|
||||
model: SystemTray.items.values
|
||||
delegate: Rectangle {
|
||||
id: systrayItem
|
||||
|
||||
required property var modelData
|
||||
property string monitor: parent.monitor
|
||||
property var model: modelData
|
||||
property string iconSource: {
|
||||
let icon = systrayItem.model && systrayItem.model.icon;
|
||||
@@ -52,7 +57,7 @@ WrapperRectangle {
|
||||
anchors.verticalCenter:parent.verticalCenter
|
||||
anchors.horizontalCenter:parent.horizontalCenter
|
||||
width:25; height:25
|
||||
source: iconSource
|
||||
source: systrayItem.iconSource
|
||||
}
|
||||
|
||||
|
||||
@@ -64,10 +69,8 @@ WrapperRectangle {
|
||||
|
||||
const globalPos = mapToGlobal(0, 0);
|
||||
|
||||
const currentScreen = systrayRoot.monitor
|
||||
const screenX = currentScreen.x || 0;
|
||||
console.log(screenX)
|
||||
const relativeX = globalPos.x - screenX;
|
||||
const currentScreen = parent.monitor
|
||||
const relativeX = globalPos.x;
|
||||
menuAnchor.menu = systrayItem.model.menu;
|
||||
menuAnchor.anchor.window = root;
|
||||
menuAnchor.anchor.rect = Qt.rect(
|
||||
|
||||
Reference in New Issue
Block a user