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
|
Exec=dms ipc call notepad openFile %f
|
||||||
Icon=danklogo
|
Icon=danklogo
|
||||||
Terminal=false
|
Terminal=false
|
||||||
|
NoDisplay=true
|
||||||
Categories=Utility;TextEditor;
|
Categories=Utility;TextEditor;
|
||||||
MimeType=text/plain;text/markdown;
|
MimeType=text/plain;text/markdown;
|
||||||
StartupNotify=false
|
StartupNotify=false
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Modals.Common
|
import qs.Modals.Common
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
@@ -23,6 +24,7 @@ DankModal {
|
|||||||
property var rememberMimeTypes: []
|
property var rememberMimeTypes: []
|
||||||
property bool rememberChoice: false
|
property bool rememberChoice: false
|
||||||
property var mimeMatchedAppIds: []
|
property var mimeMatchedAppIds: []
|
||||||
|
property var mimeMatchedRawIds: []
|
||||||
|
|
||||||
signal applicationSelected(var app, string targetData)
|
signal applicationSelected(var app, string targetData)
|
||||||
|
|
||||||
@@ -61,6 +63,7 @@ DankModal {
|
|||||||
|
|
||||||
function fetchMimeMatches() {
|
function fetchMimeMatches() {
|
||||||
mimeMatchedAppIds = [];
|
mimeMatchedAppIds = [];
|
||||||
|
mimeMatchedRawIds = [];
|
||||||
const queriedMime = mimeType;
|
const queriedMime = mimeType;
|
||||||
if (queriedMime.length === 0)
|
if (queriedMime.length === 0)
|
||||||
return;
|
return;
|
||||||
@@ -74,6 +77,7 @@ DankModal {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const ids = (response.result && response.result.desktopIds) || [];
|
const ids = (response.result && response.result.desktopIds) || [];
|
||||||
|
mimeMatchedRawIds = ids;
|
||||||
mimeMatchedAppIds = ids.map(_normAppId);
|
mimeMatchedAppIds = ids.map(_normAppId);
|
||||||
updateApplicationList();
|
updateApplicationList();
|
||||||
});
|
});
|
||||||
@@ -93,11 +97,13 @@ DankModal {
|
|||||||
const hasMimeMatches = mimeMatchedAppIds.length > 0;
|
const hasMimeMatches = mimeMatchedAppIds.length > 0;
|
||||||
const lowerQuery = searchQuery.toLowerCase();
|
const lowerQuery = searchQuery.toLowerCase();
|
||||||
let filteredApps = [];
|
let filteredApps = [];
|
||||||
|
const listedIds = new Set();
|
||||||
|
|
||||||
for (const app of apps) {
|
for (const app of apps) {
|
||||||
if (!app)
|
if (!app)
|
||||||
continue;
|
continue;
|
||||||
const appId = _normAppId(app.id || app.execString || app.exec || "");
|
const appId = _normAppId(app.id || app.execString || app.exec || "");
|
||||||
|
listedIds.add(appId);
|
||||||
const mimeIdMatch = hasMimeMatches && mimeMatchedAppIds.includes(appId);
|
const mimeIdMatch = hasMimeMatches && mimeMatchedAppIds.includes(appId);
|
||||||
const mimeFieldMatch = hasMime && _appMatchesMime(app, mimeType);
|
const mimeFieldMatch = hasMime && _appMatchesMime(app, mimeType);
|
||||||
const mimeMatch = mimeIdMatch || mimeFieldMatch;
|
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) => {
|
filteredApps.sort((a, b) => {
|
||||||
if (a.mimeMatch !== b.mimeMatch) {
|
if (a.mimeMatch !== b.mimeMatch) {
|
||||||
return a.mimeMatch ? -1 : 1;
|
return a.mimeMatch ? -1 : 1;
|
||||||
|
|||||||
@@ -777,8 +777,6 @@ Item {
|
|||||||
if (isCategoryFiltered) {
|
if (isCategoryFiltered) {
|
||||||
var rawApps = AppSearchService.getAppsInCategory(appCategory);
|
var rawApps = AppSearchService.getAppsInCategory(appCategory);
|
||||||
for (var i = 0; i < rawApps.length; i++) {
|
for (var i = 0; i < rawApps.length; i++) {
|
||||||
if (AppSearchService.isShadowedByCoreApp(rawApps[i]))
|
|
||||||
continue;
|
|
||||||
allItems.push(getOrTransformApp(rawApps[i]));
|
allItems.push(getOrTransformApp(rawApps[i]));
|
||||||
}
|
}
|
||||||
// Also include core apps (DMS Settings etc.) that match this category
|
// Also include core apps (DMS Settings etc.) that match this category
|
||||||
@@ -1174,8 +1172,6 @@ Item {
|
|||||||
var items = [];
|
var items = [];
|
||||||
|
|
||||||
for (var i = 0; i < apps.length; i++) {
|
for (var i = 0; i < apps.length; i++) {
|
||||||
if (AppSearchService.isShadowedByCoreApp(apps[i]))
|
|
||||||
continue;
|
|
||||||
items.push(getOrTransformApp(apps[i]));
|
items.push(getOrTransformApp(apps[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,16 +165,6 @@ Singleton {
|
|||||||
|
|
||||||
readonly property string dmsLogoPath: Qt.resolvedUrl("../assets/danklogo2.svg")
|
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: ({
|
readonly property var builtInPlugins: ({
|
||||||
"dms_settings": {
|
"dms_settings": {
|
||||||
id: "dms_settings",
|
id: "dms_settings",
|
||||||
|
|||||||
Reference in New Issue
Block a user