Fix launcher application icon resolution
This commit is contained in:
@@ -80,6 +80,9 @@ Item {
|
|||||||
root.cursorActive = true
|
root.cursorActive = true
|
||||||
root.disarmHover()
|
root.disarmHover()
|
||||||
root.rebuildDisplay()
|
root.rebuildDisplay()
|
||||||
|
// The shell may start before first-install packages have finished placing
|
||||||
|
// their icons. Refresh here even when the desktop entry list did not change.
|
||||||
|
if (!iconIndexScan.running) iconIndexScan.running = true
|
||||||
Qt.callLater(function() { keyCatcher.forceActiveFocus() })
|
Qt.callLater(function() { keyCatcher.forceActiveFocus() })
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,12 +103,12 @@ Item {
|
|||||||
if (value.length === 0) return Quickshell.iconPath("application-x-executable", true)
|
if (value.length === 0) return Quickshell.iconPath("application-x-executable", true)
|
||||||
if (value.indexOf("file://") === 0 || value.indexOf("image://") === 0) return value
|
if (value.indexOf("file://") === 0 || value.indexOf("image://") === 0) return value
|
||||||
if (value.charAt(0) === "/") return Util.fileUrl(value)
|
if (value.charAt(0) === "/") return Util.fileUrl(value)
|
||||||
var themed = Quickshell.iconPath(value, true)
|
// Prefer the context-limited app/device index. An unconstrained themed
|
||||||
if (themed.length > 0) return themed
|
// lookup can resolve an app name such as "zoom" to an action icon instead.
|
||||||
// Qt's themed lookup missed (commonly a just-installed app whose icon landed
|
|
||||||
// after our icon cache warmed). Fall back to the on-disk index we scanned.
|
|
||||||
var found = root.iconIndex[value]
|
var found = root.iconIndex[value]
|
||||||
if (found) return Util.fileUrl(found)
|
if (found) return Util.fileUrl(found)
|
||||||
|
var themed = Quickshell.iconPath(value, true)
|
||||||
|
if (themed.length > 0) return themed
|
||||||
return Quickshell.iconPath("application-x-executable", true)
|
return Quickshell.iconPath("application-x-executable", true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,4 +119,18 @@ assert(
|
|||||||
/function iconIndexScanCommand\(\)[\s\S]*-path "\*\/apps\/\*" -o -path "\*\/devices\/\*"/.test(launcherQml),
|
/function iconIndexScanCommand\(\)[\s\S]*-path "\*\/apps\/\*" -o -path "\*\/devices\/\*"/.test(launcherQml),
|
||||||
'launcher fallback icon index includes device icons'
|
'launcher fallback icon index includes device icons'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const iconSourceMatch = launcherQml.match(/function iconSource\(icon\) \{([\s\S]*?)\n \}/)
|
||||||
|
assert(iconSourceMatch, 'launcher iconSource function exists')
|
||||||
|
assert(
|
||||||
|
iconSourceMatch[1].indexOf('root.iconIndex[value]') < iconSourceMatch[1].indexOf('Quickshell.iconPath(value, true)'),
|
||||||
|
'launcher prefers indexed app icons over ambiguous themed icons'
|
||||||
|
)
|
||||||
|
|
||||||
|
const openMatch = launcherQml.match(/function open\(payloadJson\) \{([\s\S]*?)\n \}/)
|
||||||
|
assert(openMatch, 'launcher open function exists')
|
||||||
|
assert(
|
||||||
|
openMatch[1].includes('if (!iconIndexScan.running) iconIndexScan.running = true'),
|
||||||
|
'launcher refreshes its icon index when opened'
|
||||||
|
)
|
||||||
JS
|
JS
|
||||||
|
|||||||
Reference in New Issue
Block a user