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
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
import Quickshell
|
||||||
@@ -8,7 +10,7 @@ import qs.Common
|
|||||||
|
|
||||||
WrapperRectangle {
|
WrapperRectangle {
|
||||||
id: systrayRoot
|
id: systrayRoot
|
||||||
property var monitor: ""
|
property string monitor: ""
|
||||||
rightMargin: Theme.gaps
|
rightMargin: Theme.gaps
|
||||||
leftMargin: Theme.gaps
|
leftMargin: Theme.gaps
|
||||||
radius: 25
|
radius: 25
|
||||||
@@ -17,13 +19,16 @@ WrapperRectangle {
|
|||||||
|
|
||||||
// color: Theme.backgroudColor
|
// color: Theme.backgroudColor
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
property var monitor: parent.monitor
|
||||||
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||||
Repeater {
|
Repeater {
|
||||||
|
property string monitor: parent.monitor
|
||||||
model: SystemTray.items.values
|
model: SystemTray.items.values
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
id: systrayItem
|
id: systrayItem
|
||||||
|
|
||||||
required property var modelData
|
required property var modelData
|
||||||
|
property string monitor: parent.monitor
|
||||||
property var model: modelData
|
property var model: modelData
|
||||||
property string iconSource: {
|
property string iconSource: {
|
||||||
let icon = systrayItem.model && systrayItem.model.icon;
|
let icon = systrayItem.model && systrayItem.model.icon;
|
||||||
@@ -52,7 +57,7 @@ WrapperRectangle {
|
|||||||
anchors.verticalCenter:parent.verticalCenter
|
anchors.verticalCenter:parent.verticalCenter
|
||||||
anchors.horizontalCenter:parent.horizontalCenter
|
anchors.horizontalCenter:parent.horizontalCenter
|
||||||
width:25; height:25
|
width:25; height:25
|
||||||
source: iconSource
|
source: systrayItem.iconSource
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -64,10 +69,8 @@ WrapperRectangle {
|
|||||||
|
|
||||||
const globalPos = mapToGlobal(0, 0);
|
const globalPos = mapToGlobal(0, 0);
|
||||||
|
|
||||||
const currentScreen = systrayRoot.monitor
|
const currentScreen = parent.monitor
|
||||||
const screenX = currentScreen.x || 0;
|
const relativeX = globalPos.x;
|
||||||
console.log(screenX)
|
|
||||||
const relativeX = globalPos.x - screenX;
|
|
||||||
menuAnchor.menu = systrayItem.model.menu;
|
menuAnchor.menu = systrayItem.model.menu;
|
||||||
menuAnchor.anchor.window = root;
|
menuAnchor.anchor.window = root;
|
||||||
menuAnchor.anchor.rect = Qt.rect(
|
menuAnchor.anchor.rect = Qt.rect(
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import Quickshell
|
|||||||
ShellRoot {
|
ShellRoot {
|
||||||
Bar {
|
Bar {
|
||||||
panelMonitor: "DP-1"
|
panelMonitor: "DP-1"
|
||||||
barComponentsLeft: []
|
barComponentsLeft: ["NotificationsWidget.qml"]
|
||||||
barComponentsCenter: ["Workspaces.qml"]
|
barComponentsCenter: ["Workspaces.qml"]
|
||||||
barComponentsRight: ["AudioWidget.qml", "SysTrayWidget.qml", "ClockWidget.qml"]
|
barComponentsRight: ["AudioWidget.qml", "SysTrayWidget.qml", "ClockWidget.qml"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user