diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-21 14:24:35 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-21 14:24:35 +1000 |
| commit | 9523fdf0ebc7f98e0639ac5df2c5d2a25a8abaef (patch) | |
| tree | a510eab2f41abf791957ba23dd1bdbcde08fbaa9 /modules/sidebar | |
| parent | [CI] chore: update flake (diff) | |
| download | caelestia-shell-9523fdf0ebc7f98e0639ac5df2c5d2a25a8abaef.tar.gz caelestia-shell-9523fdf0ebc7f98e0639ac5df2c5d2a25a8abaef.tar.bz2 caelestia-shell-9523fdf0ebc7f98e0639ac5df2c5d2a25a8abaef.zip | |
sidebar/notifs: add link support
Diffstat (limited to 'modules/sidebar')
| -rw-r--r-- | modules/sidebar/Content.qml | 1 | ||||
| -rw-r--r-- | modules/sidebar/Notif.qml | 12 | ||||
| -rw-r--r-- | modules/sidebar/NotifDock.qml | 2 | ||||
| -rw-r--r-- | modules/sidebar/NotifDockList.qml | 2 | ||||
| -rw-r--r-- | modules/sidebar/NotifGroup.qml | 2 | ||||
| -rw-r--r-- | modules/sidebar/NotifGroupList.qml | 4 |
6 files changed, 22 insertions, 1 deletions
diff --git a/modules/sidebar/Content.qml b/modules/sidebar/Content.qml index 2ea8e55..1b7feed 100644 --- a/modules/sidebar/Content.qml +++ b/modules/sidebar/Content.qml @@ -25,6 +25,7 @@ Item { NotifDock { props: root.props + visibilities: root.visibilities } } diff --git a/modules/sidebar/Notif.qml b/modules/sidebar/Notif.qml index e513583..5a31764 100644 --- a/modules/sidebar/Notif.qml +++ b/modules/sidebar/Notif.qml @@ -3,6 +3,7 @@ pragma ComponentBehavior: Bound import qs.components import qs.services import qs.config +import Quickshell import QtQuick import QtQuick.Layouts @@ -12,7 +13,9 @@ StyledRect { required property Notifs.Notif modelData required property Props props required property bool expanded + required property var visibilities + readonly property StyledText body: expandedContent.item?.body ?? null readonly property real nonAnimHeight: expanded ? summary.implicitHeight + expandedContent.implicitHeight + expandedContent.anchors.topMargin + Appearance.padding.normal * 2 : summaryHeightMetrics.height implicitHeight: nonAnimHeight @@ -116,14 +119,23 @@ StyledRect { anchors.topMargin: Appearance.spacing.small / 2 sourceComponent: ColumnLayout { + readonly property alias body: body + spacing: Appearance.spacing.smaller StyledText { + id: body + Layout.fillWidth: true textFormat: Text.MarkdownText text: root.modelData.body.replace(/(.)\n(?!\n)/g, "$1\n\n") || qsTr("No body here! :/") color: root.modelData.urgency === "critical" ? Colours.palette.m3secondary : Colours.palette.m3outline wrapMode: Text.WordWrap + + onLinkActivated: link => { + Quickshell.execDetached(["app2unit", "-O", "--", link]); + root.visibilities.sidebar = false; + } } NotifActionList { diff --git a/modules/sidebar/NotifDock.qml b/modules/sidebar/NotifDock.qml index 219ae7c..b915ed9 100644 --- a/modules/sidebar/NotifDock.qml +++ b/modules/sidebar/NotifDock.qml @@ -15,6 +15,7 @@ Item { id: root required property Props props + required property var visibilities readonly property int notifCount: Notifs.list.reduce((acc, n) => n.closed ? acc : acc + 1, 0) anchors.fill: parent @@ -140,6 +141,7 @@ Item { id: notifList props: root.props + visibilities: root.visibilities container: view } } diff --git a/modules/sidebar/NotifDockList.qml b/modules/sidebar/NotifDockList.qml index 829365c..b927e91 100644 --- a/modules/sidebar/NotifDockList.qml +++ b/modules/sidebar/NotifDockList.qml @@ -11,6 +11,7 @@ Item { required property Props props required property Flickable container + required property var visibilities readonly property alias repeater: repeater readonly property int spacing: Appearance.spacing.small @@ -145,6 +146,7 @@ Item { modelData: notif.modelData props: root.props container: root.container + visibilities: root.visibilities } Behavior on x { diff --git a/modules/sidebar/NotifGroup.qml b/modules/sidebar/NotifGroup.qml index c974ce3..c230a5c 100644 --- a/modules/sidebar/NotifGroup.qml +++ b/modules/sidebar/NotifGroup.qml @@ -16,6 +16,7 @@ StyledRect { required property string modelData required property Props props required property Flickable container + required property var visibilities readonly property list<var> notifs: Notifs.list.filter(n => n.appName === modelData) readonly property int notifCount: notifs.reduce((acc, n) => n.closed ? acc : acc + 1, 0) @@ -234,6 +235,7 @@ StyledRect { notifs: root.notifs expanded: root.expanded container: root.container + visibilities: root.visibilities onRequestToggleExpand: expand => root.toggleExpand(expand) } } diff --git a/modules/sidebar/NotifGroupList.qml b/modules/sidebar/NotifGroupList.qml index c9aac27..e586b5f 100644 --- a/modules/sidebar/NotifGroupList.qml +++ b/modules/sidebar/NotifGroupList.qml @@ -14,6 +14,7 @@ Item { required property list<var> notifs required property bool expanded required property Flickable container + required property var visibilities readonly property real nonAnimHeight: { let h = -root.spacing; @@ -104,7 +105,7 @@ Item { implicitHeight: notifInner.implicitHeight hoverEnabled: true - cursorShape: pressed ? Qt.ClosedHandCursor : undefined + cursorShape: notifInner.body?.hoveredLink ? Qt.PointingHandCursor : pressed ? Qt.ClosedHandCursor : undefined acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton preventStealing: !root.expanded enabled: !modelData.closed @@ -176,6 +177,7 @@ Item { modelData: notif.modelData props: root.props expanded: root.expanded + visibilities: root.visibilities } Behavior on opacity { |