feat: quickshell rewrite wip
This commit is contained in:
1 parent
962ae7c1c7
commit
452d7080f9
36 files changed
+677
-1685
No files matched your search
@@ -0,0 +1,127 @@
|
||||
import Quickshell
|
||||
import Quickshell.Services.Notifications
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "../core"
|
||||
|
||||
PanelWindow {
|
||||
id: notifWindow
|
||||
|
||||
// Anchor to top right, just below the bar
|
||||
anchors {
|
||||
top: true
|
||||
right: true
|
||||
}
|
||||
|
||||
// Offset slightly from the screen edges
|
||||
margins {
|
||||
top: 40 // height of top bar (32) + 8 padding
|
||||
right: 8
|
||||
}
|
||||
|
||||
// Dynamic height based on notifications
|
||||
implicitWidth: 320
|
||||
implicitHeight: notifList.contentHeight
|
||||
color: "transparent"
|
||||
|
||||
// Make invisible if no notifications
|
||||
visible: notificationServer.trackedNotifications.values.length > 0
|
||||
|
||||
NotificationServer {
|
||||
id: notificationServer
|
||||
bodySupported: true
|
||||
actionsSupported: false
|
||||
inlineReplySupported: false
|
||||
imageSupported: true
|
||||
actionIconsSupported: false
|
||||
persistenceSupported: false
|
||||
|
||||
onNotification: function(notification) {
|
||||
notification.tracked = true;
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: notifList
|
||||
anchors.fill: parent
|
||||
spacing: 8
|
||||
model: notificationServer.trackedNotifications.values
|
||||
clip: false // Allow shadows or animations outside
|
||||
|
||||
delegate: Rectangle {
|
||||
id: delegateRect
|
||||
width: notifWindow.width
|
||||
height: layout.height + Theme.padding * 2
|
||||
color: Theme.bg
|
||||
radius: Theme.radius
|
||||
border.color: Theme.bgAlt
|
||||
border.width: 1
|
||||
|
||||
property var notif: modelData
|
||||
|
||||
ColumnLayout {
|
||||
id: layout
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: Theme.padding
|
||||
spacing: 4
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
Text {
|
||||
text: notif.appName || "Notification"
|
||||
color: Theme.primary
|
||||
font: Theme.fontBold
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "✕"
|
||||
color: Theme.fgAlt
|
||||
font: Theme.fontBold
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: notif.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: notif.summary || ""
|
||||
color: Theme.fg
|
||||
font: Theme.fontBold
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
|
||||
Text {
|
||||
text: notif.body || ""
|
||||
color: Theme.fgAlt
|
||||
font: Theme.font
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.Wrap
|
||||
maximumLineCount: 4
|
||||
elide: Text.ElideRight
|
||||
visible: text.length > 0
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: expireTimer
|
||||
interval: notif.expireTimeout > 0 ? (notif.expireTimeout) : 5000
|
||||
running: true
|
||||
onTriggered: notif.expire()
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
// Don't swallow clicks for the close button
|
||||
z: -1
|
||||
onClicked: notif.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user