1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

notifications: try to prevent zombies better, markdown, re-org

This commit is contained in:
bbedward
2025-07-26 16:08:58 -04:00
parent 484a947127
commit 01a94a17de
22 changed files with 684 additions and 350 deletions

View File

@@ -260,8 +260,8 @@ PanelWindow {
function onIsVisibleChanged() {
if (appDrawerPopout.isVisible)
Qt.callLater(function() {
searchField.forceActiveFocus();
});
searchField.forceActiveFocus();
});
else
searchField.clearFocus();
}

View File

@@ -36,6 +36,8 @@ Item {
property var appUsageRanking: Prefs.appUsageRanking
// Internal model
property alias model: filteredModel
// Watch AppSearchService.applications changes via property binding
property var _watchApplications: AppSearchService.applications
// Signals
signal appLaunched(var app)
@@ -81,21 +83,21 @@ Item {
var aUsage = appUsageRanking[aId] ? appUsageRanking[aId].usageCount : 0;
var bUsage = appUsageRanking[bId] ? appUsageRanking[bId].usageCount : 0;
if (aUsage !== bUsage)
return bUsage - aUsage; // Higher usage first
return bUsage - aUsage;
// Higher usage first
return (a.name || "").localeCompare(b.name || ""); // Alphabetical fallback
});
// Convert to model format and populate
apps.forEach((app) => {
if (app)
filteredModel.append({
"name": app.name || "",
"exec": app.execString || "",
"icon": app.icon || "application-x-executable",
"comment": app.comment || "",
"categories": app.categories || [],
"desktopEntry": app
});
"name": app.name || "",
"exec": app.execString || "",
"icon": app.icon || "application-x-executable",
"comment": app.comment || "",
"categories": app.categories || [],
"desktopEntry": app
});
});
}
@@ -178,11 +180,7 @@ Item {
}
onSelectedCategoryChanged: updateFilteredModel()
onAppUsageRankingChanged: updateFilteredModel()
// Watch AppSearchService.applications changes via property binding
property var _watchApplications: AppSearchService.applications
on_WatchApplicationsChanged: updateFilteredModel()
// Initialize
Component.onCompleted: {
updateFilteredModel();

View File

@@ -179,7 +179,7 @@ Column {
height: parent.height / 6
color: "transparent"
clip: true
Rectangle {
anchors.centerIn: parent
width: parent.width - 4
@@ -203,13 +203,22 @@ Column {
anchors.fill: parent
radius: parent.radius
visible: CalendarService && CalendarService.khalAvailable && CalendarService.hasEventsForDate(dayDate)
opacity: {
if (isSelected)
return 0.9;
else if (isToday)
return 0.8;
else
return 0.6;
}
gradient: Gradient {
GradientStop {
GradientStop {
position: 0.89
color: "transparent"
color: "transparent"
}
GradientStop {
GradientStop {
position: 0.9
color: {
if (isSelected)
@@ -220,8 +229,9 @@ Column {
return Theme.primary;
}
}
GradientStop {
position: 1.0
GradientStop {
position: 1
color: {
if (isSelected)
return Qt.lighter(Theme.primary, 1.3);
@@ -231,15 +241,7 @@ Column {
return Theme.primary;
}
}
}
opacity: {
if (isSelected)
return 0.9;
else if (isToday)
return 0.8;
else
return 0.6;
}
Behavior on opacity {
@@ -247,9 +249,11 @@ Column {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
}
}
MouseArea {

View File

@@ -98,11 +98,12 @@ PanelWindow {
y: Theme.barHeight + 4
// Only resize after animation is complete
onOpacityChanged: {
// Animation finished, now we can safely resize
if (opacity === 1)
// Animation finished, now we can safely resize
Qt.callLater(() => {
height = calculateHeight();
});
height = calculateHeight();
});
}
@@ -196,6 +197,7 @@ PanelWindow {
width: parent.width
height: 140
}
}
// Right section for calendar - enhanced container
@@ -209,17 +211,22 @@ PanelWindow {
CalendarGrid {
id: calendarGrid
anchors.fill: parent
anchors.margins: Theme.spacingS
}
}
}
Events {
id: events
width: parent.width
selectedDate: calendarGrid.selectedDate
}
}
Behavior on opacity {

View File

@@ -11,7 +11,7 @@ Rectangle {
property var notificationGroup
property bool expanded: NotificationService.expandedGroups[notificationGroup?.key] || false
property bool descriptionExpanded: false
property bool descriptionExpanded: NotificationService.expandedMessages[notificationGroup?.latestNotification?.notification?.id + "_desc"] || false
property bool userInitiatedExpansion: false
width: parent ? parent.width : 400
@@ -75,7 +75,8 @@ Rectangle {
border.color: "transparent"
border.width: 0
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.top: parent.top
anchors.topMargin: 18
IconImage {
anchors.fill: parent
@@ -178,7 +179,7 @@ Rectangle {
Text {
id: descriptionText
property string fullText: notificationGroup?.latestNotification?.body || ""
property string fullText: notificationGroup?.latestNotification?.htmlBody || ""
property bool hasMoreText: truncated
text: fullText
@@ -189,16 +190,33 @@ Rectangle {
maximumLineCount: descriptionExpanded ? -1 : 2
wrapMode: Text.WordWrap
visible: text.length > 0
textFormat: Text.PlainText
linkColor: Theme.primary
onLinkActivated: Qt.openUrlExternally(link)
MouseArea {
anchors.fill: parent
cursorShape: (parent.hasMoreText || descriptionExpanded) ? Qt.PointingHandCursor : Qt.ArrowCursor
enabled: parent.hasMoreText || descriptionExpanded
onClicked: {
descriptionExpanded = !descriptionExpanded;
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor :
(parent.hasMoreText || descriptionExpanded) ? Qt.PointingHandCursor :
Qt.ArrowCursor
onClicked: mouse => {
if (!parent.hoveredLink && (parent.hasMoreText || descriptionExpanded)) {
const messageId = notificationGroup?.latestNotification?.notification?.id + "_desc";
NotificationService.toggleMessageExpansion(messageId);
}
}
propagateComposedEvents: true
onPressed: mouse => {
if (parent.hoveredLink) {
mouse.accepted = false;
}
}
onReleased: mouse => {
if (parent.hoveredLink) {
mouse.accepted = false;
}
}
z: 1
}
}
}
@@ -305,7 +323,8 @@ Rectangle {
height: 32
radius: 16
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.top: parent.top
anchors.topMargin: 32
color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1)
border.color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2)
border.width: 1
@@ -384,7 +403,7 @@ Rectangle {
id: bodyText
property bool hasMoreText: truncated
text: modelData?.body || ""
text: modelData?.htmlBody || ""
color: Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall
width: parent.width
@@ -392,17 +411,31 @@ Rectangle {
maximumLineCount: messageExpanded ? -1 : 2
wrapMode: Text.WordWrap
visible: text.length > 0
textFormat: Text.PlainText
linkColor: Theme.primary
onLinkActivated: Qt.openUrlExternally(link)
MouseArea {
anchors.fill: parent
enabled: bodyText.hasMoreText || messageExpanded
cursorShape: bodyText.hasMoreText || messageExpanded ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: {
if (bodyText.hasMoreText || messageExpanded) {
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor :
(bodyText.hasMoreText || messageExpanded) ? Qt.PointingHandCursor :
Qt.ArrowCursor
onClicked: mouse => {
if (!parent.hoveredLink && (bodyText.hasMoreText || messageExpanded)) {
NotificationService.toggleMessageExpansion(modelData?.notification?.id || "");
}
}
propagateComposedEvents: true
onPressed: mouse => {
if (parent.hoveredLink) {
mouse.accepted = false;
}
}
onReleased: mouse => {
if (parent.hoveredLink) {
mouse.accepted = false;
}
}
}
}
}

View File

@@ -10,16 +10,30 @@ Item {
width: parent.width
height: 32
Text {
text: "Notifications"
font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText
font.weight: Font.Medium
Row {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
Text {
text: "Notifications"
font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText
font.weight: Font.Medium
anchors.verticalCenter: parent.verticalCenter
}
DankActionButton {
iconName: Prefs.doNotDisturb ? "notifications_off" : "notifications"
iconColor: Prefs.doNotDisturb ? Theme.error : Theme.surfaceText
buttonSize: 28
anchors.verticalCenter: parent.verticalCenter
onClicked: Prefs.setDoNotDisturb(!Prefs.doNotDisturb)
}
}
Rectangle {
id: clearAllButton
width: 120
height: 28
radius: Theme.cornerRadiusLarge

View File

@@ -1,139 +0,0 @@
import QtQuick
import Quickshell
import qs.Common
import qs.Services
QtObject {
id: manager
property int topMargin: 0
property int baseNotificationHeight: 120
property int maxTargetNotifications: 3
property var popupWindows: [] // strong refs to windows (live until exitFinished)
// Factory
property Component popupComponent: Component {
NotificationPopup {
onEntered: manager._onPopupEntered(this)
onExitFinished: manager._onPopupExitFinished(this)
}
}
property Connections notificationConnections: Connections {
target: NotificationService
function onVisibleNotificationsChanged() {
manager._sync(NotificationService.visibleNotifications);
}
}
function _hasWindowFor(w) {
return popupWindows.some(p => p && p.notificationData === w);
}
function _sync(newWrappers) {
for (let w of newWrappers) {
if (!_hasWindowFor(w)) insertNewestAtTop(w);
}
for (let p of popupWindows.slice()) {
if (p && p.notificationData && newWrappers.indexOf(p.notificationData) === -1 && !p.exiting) {
p.notificationData.removedByLimit = true;
p.notificationData.popup = false;
}
}
}
// Insert newest at top
function insertNewestAtTop(wrapper) {
// Shift live, non-exiting windows down *now*
for (let p of popupWindows) {
if (!p) continue;
if (p.exiting) continue;
// Guard: skip if p is already being destroyed
if (p.status === Component.Null) continue;
p.screenY = p.screenY + baseNotificationHeight;
}
// Create the new top window at fixed Y
const notificationId = wrapper && wrapper.notification ? wrapper.notification.id : "";
const win = popupComponent.createObject(null, { notificationData: wrapper, notificationId: notificationId, screenY: topMargin });
if (!win) {
console.warn("Popup create failed");
return;
}
popupWindows.push(win);
_maybeStartOverflow();
}
// Overflow: keep one extra (slot #4), then ask bottom to exit gracefully
function _active() {
return popupWindows.filter(p => p && p.notificationData && p.notificationData.popup);
}
function _bottom() {
let b = null, maxY = -1;
for (let p of _active()) {
if (p.exiting) continue;
if (p.screenY > maxY) {
maxY = p.screenY;
b = p;
}
}
return b;
}
function _maybeStartOverflow() {
if (_active().length <= maxTargetNotifications + 1) return;
const b = _bottom();
if (b && !b.exiting) {
// Tell the popup to animate out (don't destroy here)
b.notificationData.removedByLimit = true;
b.notificationData.popup = false;
}
}
// After entrance, you may kick overflow (optional)
function _onPopupEntered(p) {
_maybeStartOverflow();
}
// Primary cleanup path (after the popup finishes its exit)
function _onPopupExitFinished(p) {
const i = popupWindows.indexOf(p);
if (i !== -1) {
popupWindows.splice(i,1);
popupWindows = popupWindows.slice();
}
if (NotificationService.releaseWrapper)
NotificationService.releaseWrapper(p.notificationData);
// Finally destroy the window object
p.destroy();
// Compact survivors (only live, non-exiting)
const survivors = _active().filter(s => !s.exiting)
.sort((a,b) => a.screenY - b.screenY);
for (let k = 0; k < survivors.length; ++k)
survivors[k].screenY = topMargin + k * baseNotificationHeight;
_maybeStartOverflow();
}
// Optional sweeper (dev only): catch any stranded windows every 2s
property Timer sweeper: Timer {
interval: 2000
running: true
repeat: true
onTriggered: {
for (let p of popupWindows.slice()) {
if (!p) continue;
if (!p.visible && !p.notificationData) {
const i = popupWindows.indexOf(p);
if (i !== -1) {
popupWindows.splice(i,1);
popupWindows = popupWindows.slice();
}
}
}
}
}
}

View File

@@ -13,7 +13,9 @@ PanelWindow {
required property var notificationData
required property string notificationId
visible: true
readonly property bool hasValidData: notificationData && notificationData.notification
visible: hasValidData
WlrLayershell.layer: WlrLayershell.Overlay
WlrLayershell.exclusiveZone: -1
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
@@ -31,14 +33,11 @@ PanelWindow {
right: 12
}
// Manager drives vertical stacking with this proxy:
property int screenY: 0
onScreenYChanged: margins.top = Theme.barHeight + 4 + screenY
// Disable vertical tween while exiting so there is never diagonal motion
Behavior on screenY {
id: screenYAnim
enabled: !exiting
enabled: !exiting && !_isDestroying
NumberAnimation {
duration: Anims.durShort
easing.type: Easing.BezierSpline
@@ -46,19 +45,25 @@ PanelWindow {
}
}
// State
property bool exiting: false
property bool _isDestroying: false
property bool _finalized: false
signal entered()
signal exitFinished()
onHasValidDataChanged: {
if (!hasValidData && !exiting && !_isDestroying) {
console.warn("NotificationPopup: Data became invalid, forcing exit");
forceExit();
}
}
Item {
id: content
anchors.fill: parent
visible: win.hasValidData
// We animate a Translate so anchors never override horizontal motion
transform: Translate { id: tx; x: Anims.slidePx } // start off-screen right
transform: Translate { id: tx; x: Anims.slidePx }
// Optional: layer while animating for smoothness
layer.enabled: (enterX.running || exitAnim.running)
layer.smooth: true
@@ -144,7 +149,6 @@ PanelWindow {
Rectangle {
id: iconContainer
readonly property bool hasNotificationImage: notificationData && notificationData.image && notificationData.image !== ""
property alias iconImage: iconImage
width: 55
height: 55
@@ -242,7 +246,7 @@ PanelWindow {
}
Text {
text: notificationData ? (notificationData.body || "") : ""
text: notificationData ? (notificationData.htmlBody || "") : ""
color: Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall
width: parent.width
@@ -250,7 +254,13 @@ PanelWindow {
maximumLineCount: 2
wrapMode: Text.WordWrap
visible: text.length > 0
textFormat: Text.PlainText
linkColor: Theme.primary
onLinkActivated: Qt.openUrlExternally(link)
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
}
}
}
}
@@ -270,7 +280,7 @@ PanelWindow {
buttonSize: 28
z: 15
onClicked: {
if (notificationData)
if (notificationData && !win.exiting)
notificationData.popup = false;
}
}
@@ -315,7 +325,7 @@ PanelWindow {
if (modelData && modelData.invoke) {
modelData.invoke();
}
if (notificationData) {
if (notificationData && !win.exiting) {
notificationData.popup = false;
}
}
@@ -355,7 +365,7 @@ PanelWindow {
onEntered: dismissButton.isHovered = true
onExited: dismissButton.isHovered = false
onClicked: {
if (notificationData) {
if (notificationData && !win.exiting) {
NotificationService.dismissNotification(notificationData);
}
}
@@ -378,24 +388,22 @@ PanelWindow {
notificationData.timer.restart();
}
onClicked: {
if (notificationData)
if (notificationData && !win.exiting)
notificationData.popup = false;
}
}
}
}
// Entrance: slide in from right using slowed Anims curves
NumberAnimation {
id: enterX
target: tx; property: "x"; from: Anims.slidePx; to: 0
duration: Anims.durMed
easing.type: Easing.BezierSpline
easing.bezierCurve: Anims.emphasizedDecel
onStopped: if (!win.exiting && Math.abs(tx.x) < 0.5) win.entered();
onStopped: if (!win.exiting && !win._isDestroying && Math.abs(tx.x) < 0.5) win.entered();
}
// Exit: slide out to right + fade using slowed Anims curves
ParallelAnimation {
id: exitAnim
PropertyAnimation {
@@ -419,52 +427,94 @@ PanelWindow {
onStopped: finalizeExit("animStopped")
}
// Start entrance one tick after create (so it always animates)
Component.onCompleted: Qt.callLater(() => enterX.restart())
Component.onCompleted: {
if (hasValidData) {
Qt.callLater(() => enterX.restart())
} else {
console.warn("NotificationPopup created with invalid data");
forceExit();
}
}
// Safe connection to wrapper: disable automatically when wrapper is null
Connections {
id: wrapperConn
target: win.notificationData || null
ignoreUnknownSignals: true
enabled: !win._isDestroying
function onPopupChanged() {
if (!win.notificationData) return; // guard
if (!win.notificationData || win._isDestroying) return;
if (!win.notificationData.popup && !win.exiting) {
// Freeze vertical and start exit
win.exiting = true; // disables screenY Behavior
exitAnim.restart();
exitWatchdog.restart(); // safety net
if (NotificationService.removeFromVisibleNotifications)
NotificationService.removeFromVisibleNotifications(win.notificationData);
startExit();
}
}
}
onNotificationDataChanged: wrapperConn.target = win.notificationData || null
onNotificationDataChanged: {
if (!_isDestroying) {
wrapperConn.target = win.notificationData || null;
}
}
// Timer to start on entrance
Timer {
id: enterDelay
interval: 160
repeat: false
onTriggered: {
if (notificationData && notificationData.timer)
if (notificationData && notificationData.timer && !exiting && !_isDestroying)
notificationData.timer.start();
}
}
// Start timer after entrance animation
onEntered: enterDelay.start()
onEntered: {
if (!_isDestroying) enterDelay.start();
}
function startExit() {
if (exiting || _isDestroying) return;
exiting = true;
exitAnim.restart();
exitWatchdog.restart();
if (NotificationService.removeFromVisibleNotifications) {
NotificationService.removeFromVisibleNotifications(win.notificationData);
}
}
function forceExit() {
if (_isDestroying) return;
_isDestroying = true;
exiting = true;
visible = false;
exitWatchdog.stop();
finalizeExit("forced");
}
// Idempotent finalizer so we never "half-exit"
property bool _finalized: false
function finalizeExit(reason) {
if (_finalized) return;
_finalized = true;
_isDestroying = true;
exitWatchdog.stop();
win.exitFinished(); // manager will destroy the window
wrapperConn.enabled = false;
wrapperConn.target = null;
win.exitFinished();
}
Timer {
id: exitWatchdog
interval: 600
repeat: false
onTriggered: finalizeExit("watchdog")
}
Timer { id: exitWatchdog; interval: 600; repeat: false; onTriggered: finalizeExit("watchdog") }
// If the popup is torn down unexpectedly, don't leave dangling timers
Component.onDestruction: { exitWatchdog.stop(); }
Component.onDestruction: {
_isDestroying = true;
exitWatchdog.stop();
if (notificationData && notificationData.timer) {
notificationData.timer.stop();
}
}
}

View File

@@ -0,0 +1,288 @@
import QtQuick
import Quickshell
import qs.Common
import qs.Services
QtObject {
id: manager
property int topMargin: 0
property int baseNotificationHeight: 120
property int maxTargetNotifications: 3
property var popupWindows: [] // strong refs to windows (live until exitFinished)
// Track destroying windows to prevent duplicate cleanup
property var destroyingWindows: new Set()
// Factory
property Component popupComponent: Component {
NotificationPopup {
onEntered: manager._onPopupEntered(this)
onExitFinished: manager._onPopupExitFinished(this)
}
}
property Connections notificationConnections: Connections {
target: NotificationService
function onVisibleNotificationsChanged() {
manager._sync(NotificationService.visibleNotifications);
}
}
function _hasWindowFor(w) {
return popupWindows.some(p => {
// More robust check for valid windows
return p &&
p.notificationData === w &&
!p._isDestroying &&
p.status !== Component.Null;
});
}
function _isValidWindow(p) {
return p &&
p.status !== Component.Null &&
!p._isDestroying &&
p.hasValidData;
}
function _sync(newWrappers) {
// Add new notifications
for (let w of newWrappers) {
if (!_hasWindowFor(w)) {
insertNewestAtTop(w);
}
}
// Remove old notifications
for (let p of popupWindows.slice()) {
if (!_isValidWindow(p)) continue;
if (p.notificationData && newWrappers.indexOf(p.notificationData) === -1 && !p.exiting) {
p.notificationData.removedByLimit = true;
p.notificationData.popup = false;
}
}
}
// Insert newest at top
function insertNewestAtTop(wrapper) {
if (!wrapper) {
console.warn("insertNewestAtTop: wrapper is null");
return;
}
// Shift live, non-exiting windows down *now*
for (let p of popupWindows) {
if (!_isValidWindow(p)) continue;
if (p.exiting) continue;
p.screenY = p.screenY + baseNotificationHeight;
}
// Create the new top window at fixed Y
const notificationId = wrapper && wrapper.notification ? wrapper.notification.id : "";
const win = popupComponent.createObject(null, {
notificationData: wrapper,
notificationId: notificationId,
screenY: topMargin
});
if (!win) {
console.warn("Popup create failed");
return;
}
// Validate the window was created properly
if (!win.hasValidData) {
console.warn("Popup created with invalid data, destroying");
win.destroy();
return;
}
popupWindows.push(win);
// Start sweeper if it's not running
if (!sweeper.running) {
sweeper.start();
}
_maybeStartOverflow();
}
// Overflow: keep one extra (slot #4), then ask bottom to exit gracefully
function _active() {
return popupWindows.filter(p => {
return _isValidWindow(p) &&
p.notificationData &&
p.notificationData.popup &&
!p.exiting;
});
}
function _bottom() {
let b = null, maxY = -1;
for (let p of _active()) {
if (p.screenY > maxY) {
maxY = p.screenY;
b = p;
}
}
return b;
}
function _maybeStartOverflow() {
const activeWindows = _active();
if (activeWindows.length <= maxTargetNotifications + 1) return;
const b = _bottom();
if (b && !b.exiting) {
// Tell the popup to animate out (don't destroy here)
b.notificationData.removedByLimit = true;
b.notificationData.popup = false;
}
}
// After entrance, you may kick overflow (optional)
function _onPopupEntered(p) {
if (_isValidWindow(p)) {
_maybeStartOverflow();
}
}
// Primary cleanup path (after the popup finishes its exit)
function _onPopupExitFinished(p) {
if (!p) return;
// Prevent duplicate cleanup
const windowId = p.toString();
if (destroyingWindows.has(windowId)) {
return;
}
destroyingWindows.add(windowId);
// Remove from popupWindows
const i = popupWindows.indexOf(p);
if (i !== -1) {
popupWindows.splice(i, 1);
popupWindows = popupWindows.slice();
}
// Release the wrapper
if (NotificationService.releaseWrapper && p.notificationData) {
NotificationService.releaseWrapper(p.notificationData);
}
// Schedule destruction
Qt.callLater(() => {
if (p && p.destroy) {
try {
p.destroy();
} catch (e) {
console.warn("Error destroying popup:", e);
}
}
// Clean up tracking after a delay
Qt.callLater(() => {
destroyingWindows.delete(windowId);
});
});
// Compact survivors (only live, non-exiting)
const survivors = _active().sort((a, b) => a.screenY - b.screenY);
for (let k = 0; k < survivors.length; ++k) {
survivors[k].screenY = topMargin + k * baseNotificationHeight;
}
_maybeStartOverflow();
}
// Smart sweeper that only runs when needed
property Timer sweeper: Timer {
interval: 2000
running: false // Not running by default
repeat: true
onTriggered: {
let toRemove = [];
for (let p of popupWindows) {
if (!p) {
toRemove.push(p);
continue;
}
// Check for various zombie conditions
const isZombie =
p.status === Component.Null ||
(!p.visible && !p.exiting) ||
(!p.notificationData && !p._isDestroying) ||
(!p.hasValidData && !p._isDestroying);
if (isZombie) {
console.warn("Sweeper found zombie window, cleaning up");
toRemove.push(p);
// Try to force cleanup
if (p.forceExit) {
p.forceExit();
} else if (p.destroy) {
try {
p.destroy();
} catch (e) {
console.warn("Error destroying zombie:", e);
}
}
}
}
// Remove all zombies from array
if (toRemove.length > 0) {
for (let zombie of toRemove) {
const i = popupWindows.indexOf(zombie);
if (i !== -1) {
popupWindows.splice(i, 1);
}
}
popupWindows = popupWindows.slice();
// Recompact after cleanup
const survivors = _active().sort((a, b) => a.screenY - b.screenY);
for (let k = 0; k < survivors.length; ++k) {
survivors[k].screenY = topMargin + k * baseNotificationHeight;
}
}
// Stop the timer if no windows remain
if (popupWindows.length === 0) {
sweeper.stop();
}
}
}
// Watch for changes to popup windows array
onPopupWindowsChanged: {
if (popupWindows.length > 0 && !sweeper.running) {
sweeper.start();
} else if (popupWindows.length === 0 && sweeper.running) {
sweeper.stop();
}
}
// Emergency cleanup function
function cleanupAllWindows() {
sweeper.stop();
for (let p of popupWindows.slice()) {
if (p) {
try {
if (p.forceExit) p.forceExit();
else if (p.destroy) p.destroy();
} catch (e) {
console.warn("Error during emergency cleanup:", e);
}
}
}
popupWindows = [];
destroyingWindows.clear();
}
}

View File

@@ -97,7 +97,10 @@ PanelWindow {
radius: Theme.cornerRadiusLarge
border.color: Theme.outlineMedium
border.width: 1
// Remove layer rendering for better performance
antialiasing: true
smooth: true
// Material 3 elevation with multiple layers
Rectangle {
anchors.fill: parent
@@ -108,7 +111,7 @@ PanelWindow {
border.width: 1
z: -3
}
Rectangle {
anchors.fill: parent
anchors.margins: -2
@@ -118,7 +121,7 @@ PanelWindow {
border.width: 1
z: -2
}
Rectangle {
anchors.fill: parent
color: "transparent"
@@ -127,10 +130,6 @@ PanelWindow {
radius: parent.radius
z: -1
}
// Remove layer rendering for better performance
antialiasing: true
smooth: true
ScrollView {
anchors.fill: parent
@@ -180,7 +179,9 @@ PanelWindow {
batteryPopupVisible = false;
}
}
}
}
Rectangle {

View File

@@ -17,9 +17,9 @@ Rectangle {
DankIcon {
anchors.centerIn: parent
name: "notifications"
name: Prefs.doNotDisturb ? "notifications_off" : "notifications"
size: Theme.iconSize - 6
color: notificationArea.containsMouse || root.isActive ? Theme.primary : Theme.surfaceText
color: Prefs.doNotDisturb ? Theme.error : (notificationArea.containsMouse || root.isActive ? Theme.primary : Theme.surfaceText)
}
// Notification dot indicator

View File

@@ -323,6 +323,7 @@ PanelWindow {
if (controlCenterPopout.controlCenterVisible) {
if (NetworkService.wifiEnabled)
NetworkService.scanWifi();
}
}
}
@@ -333,4 +334,4 @@ PanelWindow {
}
}
}

View File

@@ -12,6 +12,17 @@ PanelWindow {
property bool volumePopupVisible: false
function show() {
root.volumePopupVisible = true;
hideTimer.restart();
}
function resetHideTimer() {
if (root.volumePopupVisible)
hideTimer.restart();
}
visible: volumePopupVisible
WlrLayershell.layer: WlrLayershell.Overlay
WlrLayershell.exclusiveZone: -1
@@ -27,40 +38,30 @@ PanelWindow {
Timer {
id: hideTimer
interval: 3000
repeat: false
onTriggered: {
if (!volumePopup.containsMouse) {
root.volumePopupVisible = false
} else {
hideTimer.restart()
}
}
}
function show() {
root.volumePopupVisible = true;
hideTimer.restart();
}
function resetHideTimer() {
if (root.volumePopupVisible) {
hideTimer.restart();
if (!volumePopup.containsMouse)
root.volumePopupVisible = false;
else
hideTimer.restart();
}
}
Connections {
target: AudioService
function onVolumeChanged() {
root.show();
}
function onSinkChanged() {
if (root.volumePopupVisible) {
root.show();
}
}
}
function onSinkChanged() {
if (root.volumePopupVisible)
root.show();
}
target: AudioService
}
Rectangle {
id: volumePopup
@@ -72,28 +73,27 @@ PanelWindow {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: Theme.spacingM
color: Theme.popupBackground()
radius: Theme.cornerRadiusLarge
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
border.width: 1
opacity: root.volumePopupVisible ? 1 : 0
scale: root.volumePopupVisible ? 1 : 0.9
layer.enabled: true
Column {
id: volumeContent
anchors.centerIn: parent
width: parent.width - Theme.spacingS * 2
spacing: Theme.spacingXS
Item {
property int gap: Theme.spacingS
width: parent.width
height: 40
property int gap: Theme.spacingS
Rectangle {
width: Theme.iconSize
height: Theme.iconSize
@@ -104,14 +104,14 @@ PanelWindow {
DankIcon {
anchors.centerIn: parent
name: AudioService.sink && AudioService.sink.audio && AudioService.sink.audio.muted ?
"volume_off" : "volume_up"
name: AudioService.sink && AudioService.sink.audio && AudioService.sink.audio.muted ? "volume_off" : "volume_up"
size: Theme.iconSize
color: muteButton.containsMouse ? Theme.primary : Theme.surfaceText
}
MouseArea {
id: muteButton
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
@@ -120,10 +120,12 @@ PanelWindow {
root.resetHideTimer();
}
}
}
DankSlider {
id: volumeSlider
width: parent.width - Theme.iconSize - parent.gap * 3
height: 40
x: parent.gap * 2 + Theme.iconSize
@@ -133,33 +135,35 @@ PanelWindow {
enabled: AudioService.sink && AudioService.sink.audio
showValue: true
unit: "%"
Connections {
target: AudioService.sink && AudioService.sink.audio ? AudioService.sink.audio : null
function onVolumeChanged() {
volumeSlider.value = Math.round(AudioService.sink.audio.volume * 100);
}
}
Component.onCompleted: {
if (AudioService.sink && AudioService.sink.audio) {
if (AudioService.sink && AudioService.sink.audio)
value = Math.round(AudioService.sink.audio.volume * 100);
}
}
onSliderValueChanged: function(newValue) {
if (AudioService.sink && AudioService.sink.audio) {
AudioService.sink.audio.volume = newValue / 100;
root.resetHideTimer();
}
}
Connections {
function onVolumeChanged() {
volumeSlider.value = Math.round(AudioService.sink.audio.volume * 100);
}
target: AudioService.sink && AudioService.sink.audio ? AudioService.sink.audio : null
}
}
}
}
MouseArea {
id: popupMouseArea
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.NoButton
@@ -167,7 +171,6 @@ PanelWindow {
z: -1
}
layer.enabled: true
layer.effect: MultiEffect {
shadowEnabled: true
shadowHorizontalOffset: 0
@@ -186,6 +189,7 @@ PanelWindow {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
Behavior on scale {
@@ -193,6 +197,7 @@ PanelWindow {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
Behavior on transform {
@@ -200,10 +205,13 @@ PanelWindow {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
}
mask: Region {
item: volumePopup
}
}
}