forked from Shinonome/dots-hyprland
notifications: copy button
This commit is contained in:
@@ -127,10 +127,10 @@ Singleton {
|
|||||||
property color colPrimaryContainerActive: mix(m3colors.m3primaryContainer, colLayer1Active, 0.6)
|
property color colPrimaryContainerActive: mix(m3colors.m3primaryContainer, colLayer1Active, 0.6)
|
||||||
property color colSecondaryHover: mix(m3colors.m3secondary, colLayer1Hover, 0.85)
|
property color colSecondaryHover: mix(m3colors.m3secondary, colLayer1Hover, 0.85)
|
||||||
property color colSecondaryActive: mix(m3colors.m3secondary, colLayer1Active, 0.4)
|
property color colSecondaryActive: mix(m3colors.m3secondary, colLayer1Active, 0.4)
|
||||||
property color colSecondaryContainerHover: mix(m3colors.m3secondaryContainer, colLayer1Hover, 0.67)
|
property color colSecondaryContainerHover: mix(m3colors.m3secondaryContainer, colLayer1Hover, 0.6)
|
||||||
property color colSecondaryContainerActive: mix(m3colors.m3secondaryContainer, colLayer1Active, 0.6)
|
property color colSecondaryContainerActive: mix(m3colors.m3secondaryContainer, colLayer1Active, 0.54)
|
||||||
property color colSurfaceContainerHighestHover: mix(m3colors.m3surfaceContainerHighest, m3colors.m3onSurface, 0.9)
|
property color colSurfaceContainerHighestHover: mix(m3colors.m3surfaceContainerHighest, m3colors.m3onSurface, 0.95)
|
||||||
property color colSurfaceContainerHighestActive: mix(m3colors.m3surfaceContainerHighest, m3colors.m3onSurface, 0.82)
|
property color colSurfaceContainerHighestActive: mix(m3colors.m3surfaceContainerHighest, m3colors.m3onSurface, 0.85)
|
||||||
property color colTooltip: m3colors.m3inverseSurface
|
property color colTooltip: m3colors.m3inverseSurface
|
||||||
property color colOnTooltip: m3colors.m3inverseOnSurface
|
property color colOnTooltip: m3colors.m3inverseOnSurface
|
||||||
property color colScrim: transparentize(m3colors.m3scrim, 0.5)
|
property color colScrim: transparentize(m3colors.m3scrim, 0.5)
|
||||||
|
|||||||
@@ -26,6 +26,11 @@ Item {
|
|||||||
command: ["bash", "-c", `qs ipc call sidebarRight close`]
|
command: ["bash", "-c", `qs ipc call sidebarRight close`]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: copyNotificationBody
|
||||||
|
command: ["bash", "-c", `wl-copy "${notificationObject.body}"`]
|
||||||
|
}
|
||||||
|
|
||||||
implicitHeight: ready ? notificationColumnLayout.implicitHeight + notificationListSpacing : 0
|
implicitHeight: ready ? notificationColumnLayout.implicitHeight + notificationListSpacing : 0
|
||||||
Behavior on implicitHeight {
|
Behavior on implicitHeight {
|
||||||
enabled: enableAnimation
|
enabled: enableAnimation
|
||||||
@@ -110,6 +115,13 @@ Item {
|
|||||||
startX = mouse.x
|
startX = mouse.x
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onPressAndHold: (mouse) => {
|
||||||
|
if (mouse.button === Qt.LeftButton) {
|
||||||
|
copyNotificationBody.running = true
|
||||||
|
notificationSummaryText.text = `${notificationObject.summary} (copied)`
|
||||||
|
console.log(notificationSummaryText.text)
|
||||||
|
}
|
||||||
|
}
|
||||||
onDragStartedChanged: () => {
|
onDragStartedChanged: () => {
|
||||||
// Prevent drag focus being shifted to parent flickable
|
// Prevent drag focus being shifted to parent flickable
|
||||||
root.parent.parent.parent.interactive = !dragStarted
|
root.parent.parent.parent.interactive = !dragStarted
|
||||||
@@ -306,6 +318,7 @@ Item {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
StyledText { // Summary
|
StyledText { // Summary
|
||||||
|
id: notificationSummaryText
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
verticalAlignment: Text.AlignBottom
|
verticalAlignment: Text.AlignBottom
|
||||||
@@ -473,15 +486,56 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NotificationActionButton {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
urgency: notificationObject.urgency
|
||||||
|
implicitWidth: (notificationObject.actions.length == 0) ? (actionsFlickable.width / 2) :
|
||||||
|
(contentItem.implicitWidth + leftPadding + rightPadding)
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
copyNotificationBody.running = true
|
||||||
|
copyIcon.text = "inventory"
|
||||||
|
copyIconTimer.stop()
|
||||||
|
copyIconTimer.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: copyIconTimer
|
||||||
|
interval: 1500
|
||||||
|
repeat: false
|
||||||
|
onTriggered: {
|
||||||
|
copyIcon.text = "content_copy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contentItem: MaterialSymbol {
|
||||||
|
id: copyIcon
|
||||||
|
font.pixelSize: Appearance.font.pixelSize.large
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
color: (notificationObject.urgency == NotificationUrgency.Critical) ?
|
||||||
|
Appearance.m3colors.m3onSurfaceVariant : Appearance.m3colors.m3onSurface
|
||||||
|
text: "content_copy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NotificationActionButton {
|
NotificationActionButton {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
buttonText: "Close"
|
buttonText: "Close"
|
||||||
urgency: notificationObject.urgency
|
urgency: notificationObject.urgency
|
||||||
implicitWidth: (notificationObject.actions.length == 0) ? (actionsFlickable.width) :
|
implicitWidth: (notificationObject.actions.length == 0) ? (actionsFlickable.width / 2) :
|
||||||
(contentItem.implicitWidth + leftPadding + rightPadding)
|
(contentItem.implicitWidth + leftPadding + rightPadding)
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Notifications.discardNotification(notificationObject.id);
|
Notifications.discardNotification(notificationObject.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
contentItem: MaterialSymbol {
|
||||||
|
font.pixelSize: Appearance.font.pixelSize.large
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
color: (notificationObject.urgency == NotificationUrgency.Critical) ?
|
||||||
|
Appearance.m3colors.m3onSurfaceVariant : Appearance.m3colors.m3onSurface
|
||||||
|
text: "close"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user