mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-01 19:18:28 -04:00
notepad: make dentry NoDisplay
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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]));
|
||||
}
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user