feat(quickshell): move notifications into HyprChrome
The notification daemon and popup stack now live under HyprChrome/Widgets/Notifications and are owned by HyprChromeShell, so popups land on the rail's monitor below its exclusive zone. Replaces widgets/notifications; NotificationCard renders headless for tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,120 +0,0 @@
|
||||
import Quickshell.Services.Notifications
|
||||
import Quickshell.Widgets
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.widgets.theme
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
|
||||
required property Notification modelData
|
||||
|
||||
spacing: 0
|
||||
Layout.fillWidth: true
|
||||
|
||||
Rectangle {
|
||||
color: Theme.accent
|
||||
implicitHeight: 5
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
WrapperRectangle {
|
||||
Layout.fillWidth: true
|
||||
|
||||
margin: 12
|
||||
border.width: 1
|
||||
border.color: Theme.accent
|
||||
color: Theme.surface
|
||||
opacity: .9
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 4
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
RowLayout {
|
||||
spacing: 8
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
IconImage {
|
||||
visible: root.modelData.appIcon !== ""
|
||||
source: root.modelData.appIcon
|
||||
implicitSize: 20
|
||||
}
|
||||
|
||||
Text {
|
||||
text: root.modelData.summary
|
||||
color: Theme.text
|
||||
font.pointSize: 14
|
||||
font.bold: true
|
||||
elide: Text.ElideRight
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Text {
|
||||
id: dismissButton
|
||||
|
||||
text: "×"
|
||||
color: Theme.accent
|
||||
font.pointSize: 18
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.modelData.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: root.modelData.body !== ""
|
||||
text: root.modelData.body
|
||||
color: Theme.text
|
||||
font.pointSize: 12
|
||||
wrapMode: Text.Wrap
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
visible: root.modelData.actions.length > 0
|
||||
spacing: 6
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
Repeater {
|
||||
model: root.modelData.actions
|
||||
|
||||
Rectangle {
|
||||
id: actionButton
|
||||
|
||||
required property NotificationAction modelData
|
||||
|
||||
color: Theme.raised
|
||||
border.width: 1
|
||||
border.color: Theme.accent
|
||||
implicitHeight: 28
|
||||
implicitWidth: actionText.implicitWidth + 16
|
||||
|
||||
Text {
|
||||
id: actionText
|
||||
anchors.centerIn: parent
|
||||
text: actionButton.modelData.text
|
||||
color: Theme.text
|
||||
font.pointSize: 12
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: actionButton.modelData.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
import Quickshell
|
||||
import Quickshell.Services.Notifications
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
|
||||
NotificationServer {
|
||||
id: server
|
||||
|
||||
keepOnReload: true
|
||||
bodySupported: true
|
||||
bodyMarkupSupported: true
|
||||
imageSupported: true
|
||||
actionsSupported: true
|
||||
actionIconsSupported: true
|
||||
|
||||
onNotification: notification => {
|
||||
notification.tracked = true;
|
||||
|
||||
const timeout = notification.expireTimeout === 0 ? 0 : notification.expireTimeout > 0 ? notification.expireTimeout : (notification.urgency === NotificationUrgency.Critical ? 0 : 5000);
|
||||
|
||||
if (timeout <= 0)
|
||||
return;
|
||||
|
||||
let closed = false;
|
||||
notification.closed.connect(() => {
|
||||
closed = true;
|
||||
});
|
||||
|
||||
const timer = expiryTimerComponent.createObject(root, {
|
||||
interval: timeout
|
||||
});
|
||||
timer.triggered.connect(() => {
|
||||
if (!closed)
|
||||
notification.expire();
|
||||
timer.destroy();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: expiryTimerComponent
|
||||
|
||||
Timer {
|
||||
running: true
|
||||
}
|
||||
}
|
||||
|
||||
PanelWindow {
|
||||
screen: Quickshell.screens.find(s => s.name === "DP-2")
|
||||
|
||||
color: "transparent"
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
right: true
|
||||
}
|
||||
|
||||
margins.top: 12
|
||||
margins.right: 12
|
||||
|
||||
implicitWidth: 340
|
||||
implicitHeight: column.implicitHeight
|
||||
|
||||
ColumnLayout {
|
||||
id: column
|
||||
anchors.fill: parent
|
||||
spacing: 8
|
||||
|
||||
Repeater {
|
||||
model: server.trackedNotifications
|
||||
|
||||
NotificationPopup {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user