1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

feat: Implement DMS Core Persistent Apps

This commit is contained in:
purian23
2026-01-04 22:33:50 -05:00
parent 145a974b6d
commit 5e03afe7f0
2 changed files with 81 additions and 3 deletions

View File

@@ -114,9 +114,13 @@ Item {
const items = AppSearchService.getPluginItems(pluginCategory, "");
emptyTriggerItems = emptyTriggerItems.concat(items);
});
apps = AppSearchService.applications.concat(emptyTriggerItems);
// Add Core Apps
const coreItems = AppSearchService.getCoreApps("");
apps = AppSearchService.applications.concat(emptyTriggerItems).concat(coreItems);
} else {
apps = AppSearchService.getAppsInCategory(selectedCategory).slice(0, maxResults);
const coreItems = AppSearchService.getCoreApps("").filter(app => app.categories.includes(selectedCategory));
apps = apps.concat(coreItems);
}
} else {
if (selectedCategory === allCategory) {
@@ -129,7 +133,9 @@ Item {
const items = AppSearchService.getPluginItems(pluginCategory, searchQuery);
emptyTriggerItems = emptyTriggerItems.concat(items);
});
apps = apps.concat(emptyTriggerItems);
const coreItems = AppSearchService.getCoreApps(searchQuery);
apps = apps.concat(emptyTriggerItems).concat(coreItems);
} else {
const categoryApps = AppSearchService.getAppsInCategory(selectedCategory);
if (categoryApps.length > 0) {
@@ -139,6 +145,9 @@ Item {
} else {
apps = [];
}
const coreItems = AppSearchService.getCoreApps(searchQuery).filter(app => app.categories.includes(selectedCategory));
apps = apps.concat(coreItems);
}
}
}
@@ -173,7 +182,7 @@ Item {
seenNames.add(itemKey);
uniqueApps.push(app);
const isPluginItem = app.action !== undefined;
const isPluginItem = app.isCore ? false : (app.action !== undefined);
filteredModel.append({
"name": app.name || "",
"exec": app.execString || app.exec || app.action || "",
@@ -181,6 +190,7 @@ Item {
"comment": app.comment || "",
"categories": app.categories || [],
"isPlugin": isPluginItem,
"isCore": app.isCore === true,
"appIndex": uniqueApps.length - 1
});
}
@@ -237,6 +247,12 @@ Item {
const actualApp = _uniqueApps[appData.appIndex];
if (appData.isCore) {
AppSearchService.executeCoreApp(actualApp);
appLaunched(appData);
return;
}
if (appData.isPlugin) {
const pluginId = getPluginIdForItem(actualApp);
if (pluginId) {

View File

@@ -42,6 +42,68 @@ Singleton {
_cachedCategories = null;
}
readonly property var coreApps: [
{
name: "DMS Settings",
icon: Qt.resolvedUrl("../assets/danklogo2.svg"),
comment: "Manage DMS configuration",
action: "ipc:settings",
categories: ["Settings", "System"],
isCore: true
},
{
name: "DMS Notepad",
icon: "material:description",
comment: "Quick notes",
action: "ipc:notepad",
categories: ["Office", "Utility"],
isCore: true
},
{
name: "DMS System Monitor",
icon: "material:monitor_heart",
comment: "System monitor and process list",
action: "ipc:processlist",
categories: ["System", "Monitor"],
isCore: true
}
]
function getCoreApps(query) {
if (!query || query.length === 0) {
return coreApps;
}
const lowerQuery = query.toLowerCase();
return coreApps.filter(app => {
return app.name.toLowerCase().includes(lowerQuery) || app.comment.toLowerCase().includes(lowerQuery);
});
}
function executeCoreApp(app) {
if (!app || !app.action) {
return false;
}
const actionParts = app.action.split(":");
const actionType = actionParts[0];
const actionTarget = actionParts[1];
if (actionType === "ipc") {
if (actionTarget === "settings") {
Quickshell.execDetached(["dms", "ipc", "call", "settings", "toggle"]);
return true;
} else if (actionTarget === "notepad") {
Quickshell.execDetached(["dms", "ipc", "call", "notepad", "toggle"]);
return true;
} else if (actionTarget === "processlist") {
Quickshell.execDetached(["dms", "ipc", "call", "processlist", "focusOrToggle"]);
return true;
}
}
return false;
}
Connections {
target: DesktopEntries
function onApplicationsChanged() {