forked from Shinonome/dots-hyprland
fix(dock): add robust retry mechanism for desktop entry lookup (#2952)
This commit is contained in:
@@ -18,7 +18,20 @@ DockButton {
|
||||
property bool appIsActive: appToplevel.toplevels.find(t => (t.activated == true)) !== undefined
|
||||
|
||||
readonly property bool isSeparator: appToplevel.appId === "SEPARATOR"
|
||||
readonly property var desktopEntry: DesktopEntries.heuristicLookup(appToplevel.appId)
|
||||
property var desktopEntry: DesktopEntries.heuristicLookup(appToplevel.appId)
|
||||
|
||||
Timer {
|
||||
// Retry looking up the desktop entry if it failed (e.g. database not loaded yet)
|
||||
property int retryCount: 5
|
||||
interval: 1000
|
||||
running: !root.isSeparator && root.desktopEntry === null && retryCount > 0
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
retryCount--;
|
||||
root.desktopEntry = DesktopEntries.heuristicLookup(root.appToplevel.appId);
|
||||
}
|
||||
}
|
||||
|
||||
enabled: !isSeparator
|
||||
implicitWidth: isSeparator ? 1 : implicitHeight - topInset - bottomInset
|
||||
|
||||
|
||||
@@ -12,7 +12,20 @@ AppButton {
|
||||
|
||||
required property var appEntry
|
||||
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: 5
|
||||
interval: 1000
|
||||
running: !root.isSeparator && root.desktopEntry === null && retryCount > 0
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
retryCount--;
|
||||
root.desktopEntry = DesktopEntries.heuristicLookup(root.appEntry.appId);
|
||||
}
|
||||
}
|
||||
|
||||
property bool active: root.appEntry.toplevels.some(t => t.activated)
|
||||
property bool hasWindows: appEntry.toplevels.length > 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user