From 61b815360b26701516f3ad5b0601068f840f7cdf Mon Sep 17 00:00:00 2001 From: Herrie Date: Wed, 22 Nov 2023 16:59:17 +0100 Subject: [PATCH] AppMenu.qml: Make sure to set the correct title of the app. There is no such items as "appmenu" in most of the appinfo.json files, only very few have it. It's better to use the title instead when available. Similar is done really in luna-sysmgr: https://github.com/openwebos/luna-sysmgr/blob/master/Src/base/application/ApplicationDescription.cpp#L534 This currently doesn't work yet for native apps such as messwerk, but we can address that later. Signed-off-by: Herman van Hazendonk --- qml/StatusBar/AppMenu.qml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/qml/StatusBar/AppMenu.qml b/qml/StatusBar/AppMenu.qml index 0ed3200..c23850c 100644 --- a/qml/StatusBar/AppMenu.qml +++ b/qml/StatusBar/AppMenu.qml @@ -38,7 +38,7 @@ Item { // now, if the appId is valid, fetch the app name if (activeWindowAppId.length > 0) { service.call("luna://com.webos.service.applicationManager/getAppInfo", - JSON.stringify({"appId":activeWindowAppId}), + JSON.stringify({"id":activeWindowAppId}), handleGetAppInfoResponse, handleGetAppInfoError); } else @@ -56,10 +56,11 @@ Item { function determineActiveWindowAppId() { var appId = ""; - if (launcherInstance.state === "justTypeLauncher") + if (launcherInstance.state === "justTypeLauncher") { appId = "com.palm.launcher"; - else - appId = cardViewInstance.getAppIdForFocusApplication(); + } else { + appId = cardViewInstance.getAppIdForFocusApplication(); + } return appId; } @@ -78,10 +79,11 @@ Item { function handleGetAppInfoResponse(message) { var response = JSON.parse(message.payload); - if (response.returnValue && response.appInfo && response.appInfo.appmenu) - activeWindowTitle = response.appInfo.appmenu; - else + if (response.returnValue && response.appInfo && (response.appInfo.appmenu || response.appInfo.title)) { + activeWindowTitle = response.appInfo.appmenu ? response.appInfo.appmenu : response.appInfo.title; + } else { activeWindowTitle = defaultAppMenuTitle; + } } function handleGetAppInfoError(error) {