mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-09 15:22:13 -04:00
refactor(icons): centralize icon resolution into Paths.resolveIconPath/resolveIconUrl (#1880)
Supersedes #1878. Rather than duplicating the moddedAppId + file path substitution pattern inline across 8 files, this introduces two centralized functions in Paths.qml: - resolveIconPath(iconName): for Quickshell.iconPath() callsites, with DesktopService.resolveIconPath() fallback - resolveIconUrl(iconName): for image://icon/ URL callsites All consumer files now use one-line calls. When no substitutions are configured, moddedAppId() returns the original name unchanged (zero cost), so this has no impact on users who don't use the feature. Affected components: - AppIconRenderer (8 lines → 1) - NotificationCard, NotificationPopup, HistoryNotificationCard - DockContextMenu, AppsDockContextMenu - LauncherContent, LauncherTab (×3) Co-authored-by: odtgit <odtgit@taliops.com>
This commit is contained in:
@@ -49,15 +49,7 @@ Item {
|
||||
readonly property string iconPath: {
|
||||
if (hasSpecialPrefix || !iconValue)
|
||||
return "";
|
||||
const moddedId = Paths.moddedAppId(iconValue);
|
||||
if (moddedId !== iconValue) {
|
||||
if (moddedId.startsWith("~") || moddedId.startsWith("/"))
|
||||
return Paths.toFileUrl(Paths.expandTilde(moddedId));
|
||||
if (moddedId.startsWith("file://"))
|
||||
return moddedId;
|
||||
return Quickshell.iconPath(moddedId, true);
|
||||
}
|
||||
return Quickshell.iconPath(iconValue, true) || DesktopService.resolveIconPath(iconValue);
|
||||
return Paths.resolveIconPath(iconValue);
|
||||
}
|
||||
|
||||
visible: iconValue !== undefined && iconValue !== ""
|
||||
|
||||
Reference in New Issue
Block a user