fix: Implement a limited retry mechanism for desktop entry lookups in app buttons.

This commit is contained in:
Akash
2026-02-16 21:44:13 +05:30
parent 8d52e83a59
commit fb1b674a30
2 changed files with 17 additions and 2 deletions
@@ -22,10 +22,12 @@ DockButton {
Timer { Timer {
// Retry looking up the desktop entry if it failed (e.g. database not loaded yet) // Retry looking up the desktop entry if it failed (e.g. database not loaded yet)
property int retryCount: 0
interval: 500 interval: 500
running: !root.isSeparator && root.desktopEntry === null running: !root.isSeparator && root.desktopEntry === null && retryCount < 30
repeat: true repeat: true
onTriggered: { onTriggered: {
retryCount++;
root.desktopEntry = DesktopEntries.heuristicLookup(root.appToplevel.appId); root.desktopEntry = DesktopEntries.heuristicLookup(root.appToplevel.appId);
} }
} }
@@ -12,7 +12,20 @@ AppButton {
required property var appEntry required property var appEntry
readonly property bool isSeparator: appEntry.appId === "SEPARATOR" readonly property bool isSeparator: appEntry.appId === "SEPARATOR"
readonly property var desktopEntry: DesktopEntries.heuristicLookup(appEntry.appId) property var desktopEntry: DesktopEntries.heuristicLookup(appEntry.appId)
Timer {
// Retry looking up the desktop entry if it failed (e.g. database not loaded yet)
property int retryCount: 0
interval: 500
running: !root.isSeparator && root.desktopEntry === null && retryCount < 30
repeat: true
onTriggered: {
retryCount++;
root.desktopEntry = DesktopEntries.heuristicLookup(root.appEntry.appId);
}
}
property bool active: root.appEntry.toplevels.some(t => t.activated) property bool active: root.appEntry.toplevels.some(t => t.activated)
property bool hasWindows: appEntry.toplevels.length > 0 property bool hasWindows: appEntry.toplevels.length > 0