1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-05 21:32:07 -04:00

Add Privacy Mode

- Smoother notification expansions
- Shadow & Privacy Toggles
This commit is contained in:
purian23
2026-02-15 01:00:55 -05:00
committed by bbedward
parent 0dba11d845
commit fd05768059
8 changed files with 212 additions and 28 deletions

View File

@@ -10,6 +10,17 @@ DankPopout {
property bool notificationHistoryVisible: false
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 {
id: keyboardController
@@ -21,10 +32,11 @@ DankPopout {
}
popupWidth: triggerScreen ? Math.min(500, Math.max(380, triggerScreen.width - 48)) : 400
popupHeight: contentLoader.item ? contentLoader.item.implicitHeight : 400
popupHeight: stablePopupHeight
positioning: ""
animationScaleCollapsed: 1.0
animationOffset: 0
suspendShadowWhileResizing: true
screen: triggerScreen
shouldBeVisible: notificationHistoryVisible
@@ -68,14 +80,25 @@ DankPopout {
Connections {
target: contentLoader
function onLoaded() {
root.updateStablePopupHeight();
if (root.shouldBeVisible)
Qt.callLater(root.setupKeyboardNavigation);
}
}
Connections {
target: contentLoader.item
function onImplicitHeightChanged() {
root.updateStablePopupHeight();
}
}
onDprChanged: updateStablePopupHeight()
onShouldBeVisibleChanged: {
if (shouldBeVisible) {
NotificationService.onOverlayOpen();
updateStablePopupHeight();
if (contentLoader.item)
Qt.callLater(setupKeyboardNavigation);
} else {

View File

@@ -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 {
width: parent.width
height: 1