quickshell: add notification center to calendar dropdown
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5c062365ea
commit
0cbd2f1ab4
1 changed files with 162 additions and 1 deletions
|
|
@ -239,7 +239,7 @@ in
|
||||||
-- Ensure hyprland-session.target starts even if HM's
|
-- Ensure hyprland-session.target starts even if HM's
|
||||||
-- dbus-update-activation-environment chain fails upstream.
|
-- dbus-update-activation-environment chain fails upstream.
|
||||||
hl.exec_cmd("systemctl --user start hyprland-session.target")
|
hl.exec_cmd("systemctl --user start hyprland-session.target")
|
||||||
hl.exec_cmd("mako")
|
-- mako removed; notifications handled by quickshell
|
||||||
|
|
||||||
hl.exec_cmd("wl-paste --type text --watch cliphist store")
|
hl.exec_cmd("wl-paste --type text --watch cliphist store")
|
||||||
hl.exec_cmd("wl-paste --type image --watch cliphist store")
|
hl.exec_cmd("wl-paste --type image --watch cliphist store")
|
||||||
|
|
@ -452,11 +452,24 @@ in
|
||||||
import Quickshell.Services.SystemTray
|
import Quickshell.Services.SystemTray
|
||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
|
import Quickshell.Services.Notifications
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Qt5Compat.GraphicalEffects
|
import Qt5Compat.GraphicalEffects
|
||||||
|
|
||||||
ShellRoot {
|
ShellRoot {
|
||||||
|
NotificationServer {
|
||||||
|
id: notifServer
|
||||||
|
bodySupported: true
|
||||||
|
actionsSupported: true
|
||||||
|
imageSupported: true
|
||||||
|
persistenceSupported: true
|
||||||
|
keepOnReload: true
|
||||||
|
onNotification: (notification) => {
|
||||||
|
notification.tracked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Variants {
|
Variants {
|
||||||
model: Quickshell.screens
|
model: Quickshell.screens
|
||||||
|
|
||||||
|
|
@ -1495,6 +1508,154 @@ in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Separator
|
||||||
|
Rectangle {
|
||||||
|
width: 7 * 28
|
||||||
|
height: 1
|
||||||
|
color: "#${c.base02}"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notifications header
|
||||||
|
Row {
|
||||||
|
width: 7 * 28
|
||||||
|
Text {
|
||||||
|
text: "Notifications"
|
||||||
|
color: "#${c.base05}"
|
||||||
|
font.family: "FiraMono Nerd Font"
|
||||||
|
font.pixelSize: 13
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
Item { Layout.fillWidth: true; width: 10 }
|
||||||
|
Text {
|
||||||
|
anchors.right: parent.right
|
||||||
|
text: notifServer.trackedNotifications.values.length > 0 ? "Clear all" : ""
|
||||||
|
color: "#${c.base04}"
|
||||||
|
font.family: "FiraMono Nerd Font"
|
||||||
|
font.pixelSize: 11
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
let notifs = notifServer.trackedNotifications.values;
|
||||||
|
for (let i = notifs.length - 1; i >= 0; i--) {
|
||||||
|
notifs[i].dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notification list
|
||||||
|
Column {
|
||||||
|
spacing: 4
|
||||||
|
width: 7 * 28
|
||||||
|
|
||||||
|
Text {
|
||||||
|
visible: notifServer.trackedNotifications.values.length === 0
|
||||||
|
text: "No notifications"
|
||||||
|
color: "#${c.base03}"
|
||||||
|
font.family: "FiraMono Nerd Font"
|
||||||
|
font.pixelSize: 11
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: notifServer.trackedNotifications
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: notifItem
|
||||||
|
required property var modelData
|
||||||
|
width: 7 * 28
|
||||||
|
height: notifCol.height + 12
|
||||||
|
radius: 6
|
||||||
|
color: "#${c.base01}"
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: notifCol
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: dismissBtn.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.margins: 6
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
text: notifItem.modelData.summary || notifItem.modelData.appName
|
||||||
|
color: "#${c.base05}"
|
||||||
|
font.family: "FiraMono Nerd Font"
|
||||||
|
font.pixelSize: 11
|
||||||
|
font.weight: Font.Medium
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
text: notifItem.modelData.body || ""
|
||||||
|
color: "#${c.base04}"
|
||||||
|
font.family: "FiraMono Nerd Font"
|
||||||
|
font.pixelSize: 10
|
||||||
|
elide: Text.ElideRight
|
||||||
|
maximumLineCount: 2
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
visible: text !== ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action buttons
|
||||||
|
Row {
|
||||||
|
spacing: 4
|
||||||
|
visible: notifItem.modelData.actions.length > 0
|
||||||
|
Repeater {
|
||||||
|
model: notifItem.modelData.actions
|
||||||
|
Rectangle {
|
||||||
|
required property var modelData
|
||||||
|
width: actionText.width + 12
|
||||||
|
height: actionText.height + 4
|
||||||
|
radius: 4
|
||||||
|
color: actionMa.containsMouse ? "#${c.base02}" : "#${c.base01}"
|
||||||
|
border.width: 1
|
||||||
|
border.color: "#${c.base02}"
|
||||||
|
Text {
|
||||||
|
id: actionText
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: modelData.text
|
||||||
|
color: "#${c.base05}"
|
||||||
|
font.family: "FiraMono Nerd Font"
|
||||||
|
font.pixelSize: 10
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
id: actionMa
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: modelData.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dismiss button
|
||||||
|
Text {
|
||||||
|
id: dismissBtn
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.margins: 6
|
||||||
|
text: "\u{f0156}"
|
||||||
|
color: dismissMa.containsMouse ? "#${c.base05}" : "#${c.base03}"
|
||||||
|
font.family: "FiraMono Nerd Font"
|
||||||
|
font.pixelSize: 12
|
||||||
|
MouseArea {
|
||||||
|
id: dismissMa
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: notifItem.modelData.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue