diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 23e1b3d..8c0bd48 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -147,7 +147,7 @@ Singleton { // Inject missing default setting (metaData) from BarWidgetRegistry const keys = Object.keys(BarWidgetRegistry.widgetMetadata[widget.id]) - for (let i=0; i 0) { + const entry = desktopEntries[0] + // Prefer name over genericName, fallback to original appName + return entry.name || entry.genericName || appName + } + + // If no desktop entry found, try to clean up the app ID + // Convert "org.gnome.Nautilus" to "Nautilus" + const parts = appName.split(".") + if (parts.length > 1) { + // Take the last part and capitalize it + const lastPart = parts[parts.length - 1] + return lastPart.charAt(0).toUpperCase() + lastPart.slice(1) + } + + return appName + } catch (e) { + // Fallback to original app name on any error + return notification.appName || "" + } + } + // Function to add notification to model function addNotification(notification) { const resolvedImage = resolveNotificationImage(notification) + const resolvedAppName = resolveAppName(notification) + notificationModel.insert(0, { "rawNotification": notification, "summary": notification.summary, "body": notification.body, - "appName": notification.appName, + "appName": resolvedAppName, "image": resolvedImage, "appIcon": notification.appIcon, "urgency": notification.urgency, @@ -177,10 +213,12 @@ Singleton { // Add a simplified copy into persistent history function addToHistory(notification) { + const resolvedAppName = resolveAppName(notification) + historyModel.insert(0, { "summary": notification.summary, "body": notification.body, - "appName": notification.appName, + "appName": resolvedAppName, "urgency": notification.urgency, "timestamp": new Date() })