1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-16 10:42:06 -04:00

(frame): QOL Control Center & Notification updates

This commit is contained in:
purian23
2026-04-16 00:06:34 -04:00
parent 59160ce5ac
commit c11069d502
10 changed files with 637 additions and 463 deletions

View File

@@ -36,6 +36,7 @@ QtObject {
property var pendingDestroys: []
property int destroyDelayMs: 100
property bool _chromeSyncPending: false
property bool _syncingVisibleNotifications: false
readonly property real chromeOpenProgressThreshold: 0.10
readonly property real chromeReleaseTailStart: 0.90
readonly property real chromeReleaseDropProgress: 0.995
@@ -160,6 +161,7 @@ QtObject {
function _sync(newWrappers) {
let needsReposition = false;
_syncingVisibleNotifications = true;
for (const p of popupWindows.slice()) {
if (!_isValidWindow(p) || p.exiting)
continue;
@@ -171,10 +173,10 @@ QtObject {
}
for (const w of newWrappers) {
if (w && !_hasWindowFor(w) && _isFocusedScreen()) {
_insertAtTop(w);
needsReposition = false;
needsReposition = _insertAtTop(w, true) || needsReposition;
}
}
_syncingVisibleNotifications = false;
if (needsReposition)
_repositionAll();
}
@@ -183,9 +185,9 @@ QtObject {
return (p.alignedHeight || p.implicitHeight || (baseNotificationHeight - popupSpacing)) + popupSpacing;
}
function _insertAtTop(wrapper) {
function _insertAtTop(wrapper, deferReposition) {
if (!wrapper)
return;
return false;
const notificationId = wrapper?.notification ? wrapper.notification.id : "";
const win = popupComponent.createObject(null, {
"notificationData": wrapper,
@@ -194,15 +196,17 @@ QtObject {
"screen": manager.modelData
});
if (!win)
return;
return false;
if (!win.hasValidData) {
win.destroy();
return;
return false;
}
popupWindows.unshift(win);
_repositionAll();
if (!deferReposition)
_repositionAll();
if (!sweeper.running)
sweeper.start();
return true;
}
function _repositionAll() {
@@ -321,6 +325,10 @@ QtObject {
if (!rect || p !== trailing || !p.popupChromeReleaseProgress)
return rect;
// Keep maxed-stack chrome anchored while a replacement tail exits.
if (p.exiting && p.notificationData?.removedByLimit && _layoutWindows().length > 0)
return rect;
const progress = _chromeReleaseTailProgress(p.popupChromeReleaseProgress());
if (progress <= 0)
return rect;
@@ -489,17 +497,34 @@ QtObject {
_scheduleNotificationChromeSync();
}
// Coalesce resize repositioning; exit-path moves remain immediate.
property bool _repositionPending: false
function _queueReposition() {
if (_repositionPending)
return;
_repositionPending = true;
Qt.callLater(_flushReposition);
}
function _flushReposition() {
_repositionPending = false;
_repositionAll();
}
function _onPopupHeightChanged(p) {
if (!p || p.exiting || p._isDestroying)
return;
if (popupWindows.indexOf(p) === -1)
return;
_repositionAll();
_queueReposition();
}
function _onPopupExitStarted(p) {
if (!p || popupWindows.indexOf(p) === -1)
return;
if (_syncingVisibleNotifications)
return;
_repositionAll();
}