mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-11 00:02:28 -04:00
Add Privacy Mode
- Smoother notification expansions - Shadow & Privacy Toggles
This commit is contained in:
@@ -472,6 +472,8 @@ Singleton {
|
|||||||
property bool dockShowOverflowBadge: true
|
property bool dockShowOverflowBadge: true
|
||||||
|
|
||||||
property bool notificationOverlayEnabled: false
|
property bool notificationOverlayEnabled: false
|
||||||
|
property bool notificationPopupShadowEnabled: true
|
||||||
|
property bool notificationPopupPrivacyMode: false
|
||||||
property int overviewRows: 2
|
property int overviewRows: 2
|
||||||
property int overviewColumns: 5
|
property int overviewColumns: 5
|
||||||
property real overviewScale: 0.16
|
property real overviewScale: 0.16
|
||||||
|
|||||||
@@ -297,6 +297,8 @@ var SPEC = {
|
|||||||
dockShowOverflowBadge: { def: true },
|
dockShowOverflowBadge: { def: true },
|
||||||
|
|
||||||
notificationOverlayEnabled: { def: false },
|
notificationOverlayEnabled: { def: false },
|
||||||
|
notificationPopupShadowEnabled: { def: true },
|
||||||
|
notificationPopupPrivacyMode: { def: false },
|
||||||
overviewRows: { def: 2, persist: false },
|
overviewRows: { def: 2, persist: false },
|
||||||
overviewColumns: { def: 5, persist: false },
|
overviewColumns: { def: 5, persist: false },
|
||||||
overviewScale: { def: 0.16, persist: false },
|
overviewScale: { def: 0.16, persist: false },
|
||||||
|
|||||||
@@ -10,6 +10,17 @@ DankPopout {
|
|||||||
|
|
||||||
property bool notificationHistoryVisible: false
|
property bool notificationHistoryVisible: false
|
||||||
property var triggerScreen: null
|
property var triggerScreen: null
|
||||||
|
property real stablePopupHeight: 400
|
||||||
|
property real _lastAlignedContentHeight: -1
|
||||||
|
|
||||||
|
function updateStablePopupHeight() {
|
||||||
|
const item = contentLoader.item;
|
||||||
|
const target = item ? Theme.px(item.implicitHeight, dpr) : 400;
|
||||||
|
if (Math.abs(target - _lastAlignedContentHeight) < 0.5)
|
||||||
|
return;
|
||||||
|
_lastAlignedContentHeight = target;
|
||||||
|
stablePopupHeight = target;
|
||||||
|
}
|
||||||
|
|
||||||
NotificationKeyboardController {
|
NotificationKeyboardController {
|
||||||
id: keyboardController
|
id: keyboardController
|
||||||
@@ -21,10 +32,11 @@ DankPopout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
popupWidth: triggerScreen ? Math.min(500, Math.max(380, triggerScreen.width - 48)) : 400
|
popupWidth: triggerScreen ? Math.min(500, Math.max(380, triggerScreen.width - 48)) : 400
|
||||||
popupHeight: contentLoader.item ? contentLoader.item.implicitHeight : 400
|
popupHeight: stablePopupHeight
|
||||||
positioning: ""
|
positioning: ""
|
||||||
animationScaleCollapsed: 1.0
|
animationScaleCollapsed: 1.0
|
||||||
animationOffset: 0
|
animationOffset: 0
|
||||||
|
suspendShadowWhileResizing: true
|
||||||
|
|
||||||
screen: triggerScreen
|
screen: triggerScreen
|
||||||
shouldBeVisible: notificationHistoryVisible
|
shouldBeVisible: notificationHistoryVisible
|
||||||
@@ -68,14 +80,25 @@ DankPopout {
|
|||||||
Connections {
|
Connections {
|
||||||
target: contentLoader
|
target: contentLoader
|
||||||
function onLoaded() {
|
function onLoaded() {
|
||||||
|
root.updateStablePopupHeight();
|
||||||
if (root.shouldBeVisible)
|
if (root.shouldBeVisible)
|
||||||
Qt.callLater(root.setupKeyboardNavigation);
|
Qt.callLater(root.setupKeyboardNavigation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: contentLoader.item
|
||||||
|
function onImplicitHeightChanged() {
|
||||||
|
root.updateStablePopupHeight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onDprChanged: updateStablePopupHeight()
|
||||||
|
|
||||||
onShouldBeVisibleChanged: {
|
onShouldBeVisibleChanged: {
|
||||||
if (shouldBeVisible) {
|
if (shouldBeVisible) {
|
||||||
NotificationService.onOverlayOpen();
|
NotificationService.onOverlayOpen();
|
||||||
|
updateStablePopupHeight();
|
||||||
if (contentLoader.item)
|
if (contentLoader.item)
|
||||||
Qt.callLater(setupKeyboardNavigation);
|
Qt.callLater(setupKeyboardNavigation);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -262,6 +262,50 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: parent.width
|
||||||
|
height: Math.max(privacyRow.implicitHeight, privacyToggle.implicitHeight) + Theme.spacingS
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: privacyRow
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "privacy_tip"
|
||||||
|
size: Theme.iconSizeSmall
|
||||||
|
color: SettingsData.notificationPopupPrivacyMode ? Theme.primary : Theme.surfaceText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
spacing: 2
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Privacy Mode")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Hide notification content until expanded")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall - 1
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DankToggle {
|
||||||
|
id: privacyToggle
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
checked: SettingsData.notificationPopupPrivacyMode
|
||||||
|
onToggled: toggled => SettingsData.set("notificationPopupPrivacyMode", toggled)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 1
|
height: 1
|
||||||
|
|||||||
@@ -20,12 +20,18 @@ PanelWindow {
|
|||||||
property bool exiting: false
|
property bool exiting: false
|
||||||
property bool _isDestroying: false
|
property bool _isDestroying: false
|
||||||
property bool _finalized: false
|
property bool _finalized: false
|
||||||
|
property real _lastReportedAlignedHeight: -1
|
||||||
readonly property string clearText: I18n.tr("Dismiss")
|
readonly property string clearText: I18n.tr("Dismiss")
|
||||||
property bool descriptionExpanded: false
|
property bool descriptionExpanded: false
|
||||||
|
readonly property bool hasExpandableBody: (notificationData?.htmlBody || "").replace(/<[^>]*>/g, "").trim().length > 0
|
||||||
onDescriptionExpandedChanged: {
|
onDescriptionExpandedChanged: {
|
||||||
popupHeightChanged();
|
popupHeightChanged();
|
||||||
}
|
}
|
||||||
onImplicitHeightChanged: {
|
onImplicitHeightChanged: {
|
||||||
|
const aligned = Theme.px(implicitHeight, dpr);
|
||||||
|
if (Math.abs(aligned - _lastReportedAlignedHeight) < 0.5)
|
||||||
|
return;
|
||||||
|
_lastReportedAlignedHeight = aligned;
|
||||||
popupHeightChanged();
|
popupHeightChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +41,9 @@ PanelWindow {
|
|||||||
readonly property real contentSpacing: compactMode ? Theme.spacingXS : Theme.spacingS
|
readonly property real contentSpacing: compactMode ? Theme.spacingXS : Theme.spacingS
|
||||||
readonly property real actionButtonHeight: compactMode ? 20 : 24
|
readonly property real actionButtonHeight: compactMode ? 20 : 24
|
||||||
readonly property real collapsedContentHeight: Math.max(popupIconSize, Theme.fontSizeSmall * 1.2 + Theme.fontSizeMedium * 1.2 + Theme.fontSizeSmall * 1.2 * (compactMode ? 1 : 2))
|
readonly property real collapsedContentHeight: Math.max(popupIconSize, Theme.fontSizeSmall * 1.2 + Theme.fontSizeMedium * 1.2 + Theme.fontSizeSmall * 1.2 * (compactMode ? 1 : 2))
|
||||||
|
readonly property real privacyCollapsedContentHeight: Math.max(popupIconSize, Theme.fontSizeSmall * 1.2 + Theme.fontSizeMedium * 1.2)
|
||||||
readonly property real basePopupHeight: cardPadding * 2 + collapsedContentHeight + actionButtonHeight + contentSpacing
|
readonly property real basePopupHeight: cardPadding * 2 + collapsedContentHeight + actionButtonHeight + contentSpacing
|
||||||
|
readonly property real basePopupHeightPrivacy: cardPadding * 2 + privacyCollapsedContentHeight + actionButtonHeight + contentSpacing
|
||||||
|
|
||||||
signal entered
|
signal entered
|
||||||
signal exitStarted
|
signal exitStarted
|
||||||
@@ -108,6 +116,8 @@ PanelWindow {
|
|||||||
color: "transparent"
|
color: "transparent"
|
||||||
implicitWidth: screen ? Math.min(400, Math.max(320, screen.width * 0.23)) : 380
|
implicitWidth: screen ? Math.min(400, Math.max(320, screen.width * 0.23)) : 380
|
||||||
implicitHeight: {
|
implicitHeight: {
|
||||||
|
if (SettingsData.notificationPopupPrivacyMode && !descriptionExpanded)
|
||||||
|
return basePopupHeightPrivacy;
|
||||||
if (!descriptionExpanded)
|
if (!descriptionExpanded)
|
||||||
return basePopupHeight;
|
return basePopupHeight;
|
||||||
const bodyTextHeight = bodyText.contentHeight || 0;
|
const bodyTextHeight = bodyText.contentHeight || 0;
|
||||||
@@ -116,12 +126,26 @@ PanelWindow {
|
|||||||
return basePopupHeight + bodyTextHeight - collapsedBodyHeight;
|
return basePopupHeight + bodyTextHeight - collapsedBodyHeight;
|
||||||
return basePopupHeight;
|
return basePopupHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
enabled: !exiting && !_isDestroying
|
||||||
|
NumberAnimation {
|
||||||
|
id: implicitHeightAnim
|
||||||
|
duration: descriptionExpanded ? Theme.notificationExpandDuration : Theme.notificationCollapseDuration
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Theme.expressiveCurves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onHasValidDataChanged: {
|
onHasValidDataChanged: {
|
||||||
if (!hasValidData && !exiting && !_isDestroying) {
|
if (!hasValidData && !exiting && !_isDestroying) {
|
||||||
forceExit();
|
forceExit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
_lastReportedAlignedHeight = Theme.px(implicitHeight, dpr);
|
||||||
|
if (SettingsData.notificationPopupPrivacyMode)
|
||||||
|
descriptionExpanded = false;
|
||||||
if (hasValidData) {
|
if (hasValidData) {
|
||||||
Qt.callLater(() => enterX.restart());
|
Qt.callLater(() => enterX.restart());
|
||||||
} else {
|
} else {
|
||||||
@@ -130,6 +154,8 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
onNotificationDataChanged: {
|
onNotificationDataChanged: {
|
||||||
if (!_isDestroying) {
|
if (!_isDestroying) {
|
||||||
|
if (SettingsData.notificationPopupPrivacyMode)
|
||||||
|
descriptionExpanded = false;
|
||||||
wrapperConn.target = win.notificationData || null;
|
wrapperConn.target = win.notificationData || null;
|
||||||
notificationConn.target = (win.notificationData && win.notificationData.notification && win.notificationData.notification.Retainable) || null;
|
notificationConn.target = (win.notificationData && win.notificationData.notification && win.notificationData.notification.Retainable) || null;
|
||||||
}
|
}
|
||||||
@@ -242,14 +268,22 @@ PanelWindow {
|
|||||||
scale: cardHoverHandler.hovered ? 1.01 : 1.0
|
scale: cardHoverHandler.hovered ? 1.01 : 1.0
|
||||||
transformOrigin: Item.Center
|
transformOrigin: Item.Center
|
||||||
|
|
||||||
|
Behavior on scale {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
easing.type: Theme.standardEasing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
property real swipeOffset: 0
|
property real swipeOffset: 0
|
||||||
readonly property real dismissThreshold: isCenterPosition ? height * 0.4 : width * 0.35
|
readonly property real dismissThreshold: isCenterPosition ? height * 0.4 : width * 0.35
|
||||||
readonly property bool swipeActive: swipeDragHandler.active
|
readonly property bool swipeActive: swipeDragHandler.active
|
||||||
property bool swipeDismissing: false
|
property bool swipeDismissing: false
|
||||||
|
|
||||||
property real shadowBlurPx: cardHoverHandler.hovered ? 16 : 10
|
readonly property real radiusForShadow: Theme.cornerRadius
|
||||||
property real shadowSpreadPx: cardHoverHandler.hovered ? 2 : 0
|
property real shadowBlurPx: SettingsData.notificationPopupShadowEnabled ? ((2 + radiusForShadow * 0.2) * (cardHoverHandler.hovered ? 1.2 : 1)) : 0
|
||||||
property real shadowBaseAlpha: 0.60
|
property real shadowSpreadPx: SettingsData.notificationPopupShadowEnabled ? (radiusForShadow * (cardHoverHandler.hovered ? 0.06 : 0)) : 0
|
||||||
|
property real shadowBaseAlpha: 0.35
|
||||||
readonly property real popupSurfaceAlpha: SettingsData.popupTransparency
|
readonly property real popupSurfaceAlpha: SettingsData.popupTransparency
|
||||||
readonly property real effectiveShadowAlpha: Math.max(0, Math.min(1, shadowBaseAlpha * popupSurfaceAlpha))
|
readonly property real effectiveShadowAlpha: Math.max(0, Math.min(1, shadowBaseAlpha * popupSurfaceAlpha))
|
||||||
|
|
||||||
@@ -267,18 +301,11 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on scale {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
easing.type: Theme.standardEasing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: bgShadowLayer
|
id: bgShadowLayer
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.snap(4, win.dpr)
|
anchors.margins: Theme.snap(4, win.dpr)
|
||||||
layer.enabled: !win._isDestroying && win.screenValid
|
layer.enabled: !win._isDestroying && win.screenValid && !implicitHeightAnim.running
|
||||||
layer.smooth: false
|
layer.smooth: false
|
||||||
layer.textureSize: Qt.size(Math.round(width * win.dpr), Math.round(height * win.dpr))
|
layer.textureSize: Qt.size(Math.round(width * win.dpr), Math.round(height * win.dpr))
|
||||||
layer.textureMirroring: ShaderEffectSource.MirrorVertically
|
layer.textureMirroring: ShaderEffectSource.MirrorVertically
|
||||||
@@ -288,7 +315,7 @@ PanelWindow {
|
|||||||
layer.effect: MultiEffect {
|
layer.effect: MultiEffect {
|
||||||
id: shadowFx
|
id: shadowFx
|
||||||
autoPaddingEnabled: true
|
autoPaddingEnabled: true
|
||||||
shadowEnabled: true
|
shadowEnabled: SettingsData.notificationPopupShadowEnabled
|
||||||
blurEnabled: false
|
blurEnabled: false
|
||||||
maskEnabled: false
|
maskEnabled: false
|
||||||
shadowBlur: Math.max(0, Math.min(1, content.shadowBlurPx / bgShadowLayer.blurMax))
|
shadowBlur: Math.max(0, Math.min(1, content.shadowBlurPx / bgShadowLayer.blurMax))
|
||||||
@@ -300,7 +327,7 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: backgroundShape
|
id: shadowShapeSource
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
||||||
@@ -310,7 +337,7 @@ PanelWindow {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: backgroundShape.radius
|
radius: shadowShapeSource.radius
|
||||||
visible: notificationData && notificationData.urgency === NotificationUrgency.Critical
|
visible: notificationData && notificationData.urgency === NotificationUrgency.Critical
|
||||||
opacity: 1
|
opacity: 1
|
||||||
clip: true
|
clip: true
|
||||||
@@ -346,6 +373,20 @@ PanelWindow {
|
|||||||
id: cardHoverHandler
|
id: cardHoverHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: cardHoverHandler
|
||||||
|
function onHoveredChanged() {
|
||||||
|
if (!notificationData || win.exiting || win._isDestroying)
|
||||||
|
return;
|
||||||
|
if (cardHoverHandler.hovered) {
|
||||||
|
if (notificationData.timer)
|
||||||
|
notificationData.timer.stop();
|
||||||
|
} else if (notificationData.popup && notificationData.timer) {
|
||||||
|
notificationData.timer.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LayoutMirroring.enabled: I18n.isRtl
|
LayoutMirroring.enabled: I18n.isRtl
|
||||||
LayoutMirroring.childrenInherit: true
|
LayoutMirroring.childrenInherit: true
|
||||||
|
|
||||||
@@ -354,6 +395,7 @@ PanelWindow {
|
|||||||
|
|
||||||
readonly property real expandedTextHeight: bodyText.contentHeight || 0
|
readonly property real expandedTextHeight: bodyText.contentHeight || 0
|
||||||
readonly property real collapsedBodyHeight: Theme.fontSizeSmall * 1.2 * (compactMode ? 1 : 2)
|
readonly property real collapsedBodyHeight: Theme.fontSizeSmall * 1.2 * (compactMode ? 1 : 2)
|
||||||
|
readonly property real effectiveCollapsedHeight: (SettingsData.notificationPopupPrivacyMode && !descriptionExpanded) ? win.privacyCollapsedContentHeight : win.collapsedContentHeight
|
||||||
readonly property real extraHeight: (descriptionExpanded && expandedTextHeight > collapsedBodyHeight + 2) ? (expandedTextHeight - collapsedBodyHeight) : 0
|
readonly property real extraHeight: (descriptionExpanded && expandedTextHeight > collapsedBodyHeight + 2) ? (expandedTextHeight - collapsedBodyHeight) : 0
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
@@ -362,7 +404,8 @@ PanelWindow {
|
|||||||
anchors.topMargin: cardPadding
|
anchors.topMargin: cardPadding
|
||||||
anchors.leftMargin: Theme.spacingL
|
anchors.leftMargin: Theme.spacingL
|
||||||
anchors.rightMargin: Theme.spacingL + Theme.notificationHoverRevealMargin
|
anchors.rightMargin: Theme.spacingL + Theme.notificationHoverRevealMargin
|
||||||
height: collapsedContentHeight + extraHeight
|
height: effectiveCollapsedHeight + extraHeight
|
||||||
|
clip: SettingsData.notificationPopupPrivacyMode && !descriptionExpanded
|
||||||
|
|
||||||
DankCircularImage {
|
DankCircularImage {
|
||||||
id: iconContainer
|
id: iconContainer
|
||||||
@@ -384,7 +427,15 @@ PanelWindow {
|
|||||||
height: popupIconSize
|
height: popupIconSize
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: descriptionExpanded ? Math.max(0, Theme.fontSizeSmall * 1.2 + (Theme.fontSizeMedium * 1.2 + Theme.fontSizeSmall * 1.2 * (compactMode ? 1 : 2)) / 2 - popupIconSize / 2) : Math.max(0, Theme.fontSizeSmall * 1.2 + (textContainer.height - Theme.fontSizeSmall * 1.2) / 2 - popupIconSize / 2)
|
anchors.topMargin: {
|
||||||
|
if (SettingsData.notificationPopupPrivacyMode && !descriptionExpanded) {
|
||||||
|
const headerSummary = Theme.fontSizeSmall * 1.2 + Theme.fontSizeMedium * 1.2;
|
||||||
|
return Math.max(0, headerSummary / 2 - popupIconSize / 2);
|
||||||
|
}
|
||||||
|
if (descriptionExpanded)
|
||||||
|
return Math.max(0, Theme.fontSizeSmall * 1.2 + (Theme.fontSizeMedium * 1.2 + Theme.fontSizeSmall * 1.2 * (compactMode ? 1 : 2)) / 2 - popupIconSize / 2);
|
||||||
|
return Math.max(0, Theme.fontSizeSmall * 1.2 + (textContainer.height - Theme.fontSizeSmall * 1.2) / 2 - popupIconSize / 2);
|
||||||
|
}
|
||||||
|
|
||||||
imageSource: {
|
imageSource: {
|
||||||
if (!notificationData)
|
if (!notificationData)
|
||||||
@@ -499,6 +550,7 @@ PanelWindow {
|
|||||||
maximumLineCount: descriptionExpanded ? -1 : (compactMode ? 1 : 2)
|
maximumLineCount: descriptionExpanded ? -1 : (compactMode ? 1 : 2)
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
visible: text.length > 0
|
visible: text.length > 0
|
||||||
|
opacity: (SettingsData.notificationPopupPrivacyMode && !descriptionExpanded) ? 0 : 1
|
||||||
linkColor: Theme.primary
|
linkColor: Theme.primary
|
||||||
onLinkActivated: link => Qt.openUrlExternally(link)
|
onLinkActivated: link => Qt.openUrlExternally(link)
|
||||||
|
|
||||||
@@ -522,6 +574,14 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Message Content", "notification privacy mode placeholder")
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
width: parent.width
|
||||||
|
visible: SettingsData.notificationPopupPrivacyMode && !descriptionExpanded && win.hasExpandableBody
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,6 +603,25 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DankActionButton {
|
||||||
|
id: expandButton
|
||||||
|
|
||||||
|
anchors.right: closeButton.left
|
||||||
|
anchors.rightMargin: Theme.spacingXS
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: cardPadding
|
||||||
|
iconName: descriptionExpanded ? "expand_less" : "expand_more"
|
||||||
|
iconSize: compactMode ? 14 : 16
|
||||||
|
buttonSize: compactMode ? 20 : 24
|
||||||
|
z: 15
|
||||||
|
visible: SettingsData.notificationPopupPrivacyMode && win.hasExpandableBody
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (win.hasExpandableBody)
|
||||||
|
win.descriptionExpanded = !win.descriptionExpanded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
visible: cardHoverHandler.hovered
|
visible: cardHoverHandler.hovered
|
||||||
opacity: visible ? 1 : 0
|
opacity: visible ? 1 : 0
|
||||||
@@ -657,21 +736,14 @@ PanelWindow {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
propagateComposedEvents: true
|
propagateComposedEvents: true
|
||||||
z: -1
|
z: -1
|
||||||
onEntered: {
|
|
||||||
if (notificationData && notificationData.timer)
|
|
||||||
notificationData.timer.stop();
|
|
||||||
}
|
|
||||||
onExited: {
|
|
||||||
if (notificationData && notificationData.popup && notificationData.timer)
|
|
||||||
notificationData.timer.restart();
|
|
||||||
}
|
|
||||||
onClicked: mouse => {
|
onClicked: mouse => {
|
||||||
if (!notificationData || win.exiting)
|
if (!notificationData || win.exiting)
|
||||||
return;
|
return;
|
||||||
if (mouse.button === Qt.RightButton) {
|
if (mouse.button === Qt.RightButton) {
|
||||||
popupContextMenu.popup();
|
popupContextMenu.popup();
|
||||||
} else if (mouse.button === Qt.LeftButton) {
|
} else if (mouse.button === Qt.LeftButton) {
|
||||||
if (bodyText.hasMoreText || win.descriptionExpanded) {
|
const canExpand = bodyText.hasMoreText || win.descriptionExpanded || (SettingsData.notificationPopupPrivacyMode && win.hasExpandableBody);
|
||||||
|
if (canExpand) {
|
||||||
win.descriptionExpanded = !win.descriptionExpanded;
|
win.descriptionExpanded = !win.descriptionExpanded;
|
||||||
} else if (notificationData.actions && notificationData.actions.length > 0) {
|
} else if (notificationData.actions && notificationData.actions.length > 0) {
|
||||||
notificationData.actions[0].invoke();
|
notificationData.actions[0].invoke();
|
||||||
|
|||||||
@@ -289,7 +289,8 @@ QtObject {
|
|||||||
let currentY = topMargin;
|
let currentY = topMargin;
|
||||||
for (const win of activeWindows) {
|
for (const win of activeWindows) {
|
||||||
win.screenY = currentY;
|
win.screenY = currentY;
|
||||||
currentY += win.implicitHeight + popupSpacing;
|
const popupHeight = win.alignedHeight || win.implicitHeight;
|
||||||
|
currentY += popupHeight + popupSpacing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -270,6 +270,24 @@ Item {
|
|||||||
onToggled: checked => SettingsData.set("notificationCompactMode", checked)
|
onToggled: checked => SettingsData.set("notificationCompactMode", checked)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SettingsToggleRow {
|
||||||
|
settingKey: "notificationPopupShadowEnabled"
|
||||||
|
tags: ["notification", "popup", "shadow", "radius", "rounded"]
|
||||||
|
text: I18n.tr("Popup Shadow")
|
||||||
|
description: I18n.tr("Show drop shadow on notification popups")
|
||||||
|
checked: SettingsData.notificationPopupShadowEnabled
|
||||||
|
onToggled: checked => SettingsData.set("notificationPopupShadowEnabled", checked)
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsToggleRow {
|
||||||
|
settingKey: "notificationPopupPrivacyMode"
|
||||||
|
tags: ["notification", "popup", "privacy", "body", "content", "hide"]
|
||||||
|
text: I18n.tr("Privacy Mode")
|
||||||
|
description: I18n.tr("Hide notification content until expanded; popups show collapsed by default")
|
||||||
|
checked: SettingsData.notificationPopupPrivacyMode
|
||||||
|
onToggled: checked => SettingsData.set("notificationPopupPrivacyMode", checked)
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: notificationAnimationColumn.implicitHeight + Theme.spacingM * 2
|
height: notificationAnimationColumn.implicitHeight + Theme.spacingM * 2
|
||||||
|
|||||||
@@ -25,10 +25,12 @@ Item {
|
|||||||
property real animationOffset: Theme.spacingL
|
property real animationOffset: Theme.spacingL
|
||||||
property list<real> animationEnterCurve: Theme.expressiveCurves.expressiveDefaultSpatial
|
property list<real> animationEnterCurve: Theme.expressiveCurves.expressiveDefaultSpatial
|
||||||
property list<real> animationExitCurve: Theme.expressiveCurves.emphasized
|
property list<real> animationExitCurve: Theme.expressiveCurves.emphasized
|
||||||
|
property bool suspendShadowWhileResizing: false
|
||||||
property bool shouldBeVisible: false
|
property bool shouldBeVisible: false
|
||||||
property var customKeyboardFocus: null
|
property var customKeyboardFocus: null
|
||||||
property bool backgroundInteractive: true
|
property bool backgroundInteractive: true
|
||||||
property bool contentHandlesKeys: false
|
property bool contentHandlesKeys: false
|
||||||
|
property bool _resizeActive: false
|
||||||
|
|
||||||
property real storedBarThickness: Theme.barHeight - 4
|
property real storedBarThickness: Theme.barHeight - 4
|
||||||
property real storedBarSpacing: 4
|
property real storedBarSpacing: 4
|
||||||
@@ -185,6 +187,26 @@ Item {
|
|||||||
readonly property real alignedWidth: Theme.px(popupWidth, dpr)
|
readonly property real alignedWidth: Theme.px(popupWidth, dpr)
|
||||||
readonly property real alignedHeight: Theme.px(popupHeight, dpr)
|
readonly property real alignedHeight: Theme.px(popupHeight, dpr)
|
||||||
|
|
||||||
|
onAlignedHeightChanged: {
|
||||||
|
if (!suspendShadowWhileResizing || !shouldBeVisible)
|
||||||
|
return;
|
||||||
|
_resizeActive = true;
|
||||||
|
resizeSettleTimer.restart();
|
||||||
|
}
|
||||||
|
onShouldBeVisibleChanged: {
|
||||||
|
if (!shouldBeVisible) {
|
||||||
|
_resizeActive = false;
|
||||||
|
resizeSettleTimer.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: resizeSettleTimer
|
||||||
|
interval: 80
|
||||||
|
repeat: false
|
||||||
|
onTriggered: root._resizeActive = false
|
||||||
|
}
|
||||||
|
|
||||||
readonly property real alignedX: Theme.snap((() => {
|
readonly property real alignedX: Theme.snap((() => {
|
||||||
const useAutoGaps = storedBarConfig?.popupGapsAuto !== undefined ? storedBarConfig.popupGapsAuto : true;
|
const useAutoGaps = storedBarConfig?.popupGapsAuto !== undefined ? storedBarConfig.popupGapsAuto : true;
|
||||||
const manualGapValue = storedBarConfig?.popupGapsManual !== undefined ? storedBarConfig.popupGapsManual : 4;
|
const manualGapValue = storedBarConfig?.popupGapsManual !== undefined ? storedBarConfig.popupGapsManual : 4;
|
||||||
@@ -440,7 +462,7 @@ Item {
|
|||||||
readonly property real effectiveShadowAlpha: Math.max(0, Math.min(1, shadowBaseAlpha * popupSurfaceAlpha))
|
readonly property real effectiveShadowAlpha: Math.max(0, Math.min(1, shadowBaseAlpha * popupSurfaceAlpha))
|
||||||
readonly property int blurMax: 64
|
readonly property int blurMax: 64
|
||||||
|
|
||||||
layer.enabled: Quickshell.env("DMS_DISABLE_LAYER") !== "true" && Quickshell.env("DMS_DISABLE_LAYER") !== "1"
|
layer.enabled: Quickshell.env("DMS_DISABLE_LAYER") !== "true" && Quickshell.env("DMS_DISABLE_LAYER") !== "1" && !(root.suspendShadowWhileResizing && root._resizeActive)
|
||||||
layer.smooth: false
|
layer.smooth: false
|
||||||
layer.textureSize: root.dpr > 1 ? Qt.size(Math.ceil(width * root.dpr), Math.ceil(height * root.dpr)) : Qt.size(0, 0)
|
layer.textureSize: root.dpr > 1 ? Qt.size(Math.ceil(width * root.dpr), Math.ceil(height * root.dpr)) : Qt.size(0, 0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user