sidebar/notifs: add link support
This commit is contained in:
parent
f9da00e6fb
commit
9523fdf0eb
6 changed files with 22 additions and 1 deletions
|
|
@ -25,6 +25,7 @@ Item {
|
|||
|
||||
NotifDock {
|
||||
props: root.props
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue