From d05255c15b1486dc7f931cf35504f55a1317f777 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Mon, 8 Sep 2025 15:38:29 +0200 Subject: [PATCH] Notification: show resolved app name instead of id (possibly fixes #230) --- Commons/Settings.qml | 2 +- Services/NotificationService.qml | 42 ++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) 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() })