From ea0c235d6eef6dda74de8bf9df3f4d9e83e2bdd2 Mon Sep 17 00:00:00 2001 From: bbedward Date: Sat, 4 Jul 2026 17:00:43 -0400 Subject: [PATCH] notepad: make dentry NoDisplay --- assets/com.danklinux.dms.notepad.desktop | 1 + quickshell/Modals/AppPickerModal.qml | 28 +++++++++++++++++++ .../Modals/DankLauncherV2/Controller.qml | 4 --- quickshell/Services/AppSearchService.qml | 10 ------- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/assets/com.danklinux.dms.notepad.desktop b/assets/com.danklinux.dms.notepad.desktop index 63ed258a4..e587f385f 100644 --- a/assets/com.danklinux.dms.notepad.desktop +++ b/assets/com.danklinux.dms.notepad.desktop @@ -6,6 +6,7 @@ Comment=Quick notes and text files in the dank desktop shell Exec=dms ipc call notepad openFile %f Icon=danklogo Terminal=false +NoDisplay=true Categories=Utility;TextEditor; MimeType=text/plain;text/markdown; StartupNotify=false diff --git a/quickshell/Modals/AppPickerModal.qml b/quickshell/Modals/AppPickerModal.qml index a964f2513..e5eb5f216 100644 --- a/quickshell/Modals/AppPickerModal.qml +++ b/quickshell/Modals/AppPickerModal.qml @@ -1,4 +1,5 @@ import QtQuick +import Quickshell import qs.Common import qs.Modals.Common import qs.Widgets @@ -23,6 +24,7 @@ DankModal { property var rememberMimeTypes: [] property bool rememberChoice: false property var mimeMatchedAppIds: [] + property var mimeMatchedRawIds: [] signal applicationSelected(var app, string targetData) @@ -61,6 +63,7 @@ DankModal { function fetchMimeMatches() { mimeMatchedAppIds = []; + mimeMatchedRawIds = []; const queriedMime = mimeType; if (queriedMime.length === 0) return; @@ -74,6 +77,7 @@ DankModal { return; } const ids = (response.result && response.result.desktopIds) || []; + mimeMatchedRawIds = ids; mimeMatchedAppIds = ids.map(_normAppId); updateApplicationList(); }); @@ -93,11 +97,13 @@ DankModal { const hasMimeMatches = mimeMatchedAppIds.length > 0; const lowerQuery = searchQuery.toLowerCase(); let filteredApps = []; + const listedIds = new Set(); for (const app of apps) { if (!app) continue; const appId = _normAppId(app.id || app.execString || app.exec || ""); + listedIds.add(appId); const mimeIdMatch = hasMimeMatches && mimeMatchedAppIds.includes(appId); const mimeFieldMatch = hasMime && _appMatchesMime(app, mimeType); const mimeMatch = mimeIdMatch || mimeFieldMatch; @@ -135,6 +141,28 @@ DankModal { }); } + // NoDisplay entries are excluded from DesktopEntries.applications but + // remain valid mime handlers; resolve them by id so they stay pickable + for (const rawId of mimeMatchedRawIds) { + const normId = _normAppId(rawId); + if (normId === "dms-open" || listedIds.has(normId)) + continue; + const entry = DesktopEntries.byId(rawId) || DesktopEntries.heuristicLookup(rawId); + if (!entry) + continue; + const name = entry.name || ""; + if (searchQuery !== "" && !name.toLowerCase().includes(lowerQuery)) + continue; + filteredApps.push({ + name: name, + icon: entry.icon || "application-x-executable", + exec: entry.execString || "", + startupClass: entry.startupClass || "", + appData: entry, + mimeMatch: true + }); + } + filteredApps.sort((a, b) => { if (a.mimeMatch !== b.mimeMatch) { return a.mimeMatch ? -1 : 1; diff --git a/quickshell/Modals/DankLauncherV2/Controller.qml b/quickshell/Modals/DankLauncherV2/Controller.qml index 0f926f7e0..b6782e58e 100644 --- a/quickshell/Modals/DankLauncherV2/Controller.qml +++ b/quickshell/Modals/DankLauncherV2/Controller.qml @@ -777,8 +777,6 @@ Item { if (isCategoryFiltered) { var rawApps = AppSearchService.getAppsInCategory(appCategory); for (var i = 0; i < rawApps.length; i++) { - if (AppSearchService.isShadowedByCoreApp(rawApps[i])) - continue; allItems.push(getOrTransformApp(rawApps[i])); } // Also include core apps (DMS Settings etc.) that match this category @@ -1174,8 +1172,6 @@ Item { var items = []; for (var i = 0; i < apps.length; i++) { - if (AppSearchService.isShadowedByCoreApp(apps[i])) - continue; items.push(getOrTransformApp(apps[i])); } diff --git a/quickshell/Services/AppSearchService.qml b/quickshell/Services/AppSearchService.qml index 1c05d660a..4ac2a37ec 100644 --- a/quickshell/Services/AppSearchService.qml +++ b/quickshell/Services/AppSearchService.qml @@ -165,16 +165,6 @@ Singleton { readonly property string dmsLogoPath: Qt.resolvedUrl("../assets/danklogo2.svg") - // Prevent desktop entry duplicates from core apps - readonly property var builtInShadowDesktopIds: ["com.danklinux.dms.notepad"] - - function isShadowedByCoreApp(app) { - if (!app) - return false; - const id = (app.id || "").replace(/\.desktop$/, ""); - return builtInShadowDesktopIds.includes(id); - } - readonly property var builtInPlugins: ({ "dms_settings": { id: "dms_settings",