mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-08 12:13:31 -04:00
feat(Clipboard): Implement clipboard/settings search functionality in DMS Launcher
This commit is contained in:
@@ -211,11 +211,21 @@ Singleton {
|
||||
},
|
||||
"dms_settings_search": {
|
||||
id: "dms_settings_search",
|
||||
name: I18n.tr("Settings", "settings window title"),
|
||||
name: I18n.tr("Settings Search"),
|
||||
cornerIcon: "search",
|
||||
comment: "DMS",
|
||||
comment: I18n.tr("DMS Settings"),
|
||||
defaultTrigger: "?",
|
||||
isLauncher: true
|
||||
},
|
||||
"dms_clipboard_search": {
|
||||
id: "dms_clipboard_search",
|
||||
name: I18n.tr("Clipboard"),
|
||||
cornerIcon: "content_paste",
|
||||
comment: "DMS",
|
||||
defaultTrigger: "cb",
|
||||
isLauncher: true,
|
||||
viewMode: "list",
|
||||
viewModeEnforced: true
|
||||
}
|
||||
})
|
||||
|
||||
@@ -285,6 +295,16 @@ Singleton {
|
||||
}
|
||||
|
||||
function getBuiltInLauncherItems(pluginId, query) {
|
||||
if (pluginId === "dms_clipboard_search") {
|
||||
ClipboardService.ensureLauncherHistory();
|
||||
const trimmed = (query || "").toString().trim();
|
||||
const entries = trimmed.length === 0 ? ClipboardService.getRecentLauncherEntries(20) : ClipboardService.getLauncherEntries(trimmed, 20, 1);
|
||||
return entries.map(entry => ({
|
||||
type: "clipboard",
|
||||
data: entry
|
||||
}));
|
||||
}
|
||||
|
||||
if (pluginId !== "dms_settings_search")
|
||||
return [];
|
||||
|
||||
@@ -295,10 +315,15 @@ Singleton {
|
||||
const r = results[i];
|
||||
items.push({
|
||||
name: r.label,
|
||||
type: "setting",
|
||||
section: "settings",
|
||||
icon: "material:" + r.icon,
|
||||
comment: r.category,
|
||||
comment: r.description || r.category,
|
||||
action: "settings_nav:" + r.tabIndex + ":" + r.section,
|
||||
categories: ["Settings"],
|
||||
keywords: r.keywords || [],
|
||||
source: I18n.tr("Settings", "settings window title"),
|
||||
badgeLabel: I18n.tr("Setting"),
|
||||
isCore: true,
|
||||
isBuiltInLauncher: true,
|
||||
builtInPluginId: pluginId
|
||||
|
||||
Reference in New Issue
Block a user