mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
launcher: built-in plugins, add settings search plugin with ? default
trigger
This commit is contained in:
@@ -62,6 +62,22 @@ Singleton {
|
|||||||
property bool _hasUnsavedChanges: false
|
property bool _hasUnsavedChanges: false
|
||||||
property var _loadedSettingsSnapshot: null
|
property var _loadedSettingsSnapshot: null
|
||||||
property var pluginSettings: ({})
|
property var pluginSettings: ({})
|
||||||
|
property var builtInPluginSettings: ({})
|
||||||
|
|
||||||
|
function getBuiltInPluginSetting(pluginId, key, defaultValue) {
|
||||||
|
if (!builtInPluginSettings[pluginId])
|
||||||
|
return defaultValue;
|
||||||
|
return builtInPluginSettings[pluginId][key] !== undefined ? builtInPluginSettings[pluginId][key] : defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setBuiltInPluginSetting(pluginId, key, value) {
|
||||||
|
const updated = JSON.parse(JSON.stringify(builtInPluginSettings));
|
||||||
|
if (!updated[pluginId])
|
||||||
|
updated[pluginId] = {};
|
||||||
|
updated[pluginId][key] = value;
|
||||||
|
builtInPluginSettings = updated;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
property alias dankBarLeftWidgetsModel: leftWidgetsModel
|
property alias dankBarLeftWidgetsModel: leftWidgetsModel
|
||||||
property alias dankBarCenterWidgetsModel: centerWidgetsModel
|
property alias dankBarCenterWidgetsModel: centerWidgetsModel
|
||||||
|
|||||||
@@ -382,7 +382,9 @@ var SPEC = {
|
|||||||
desktopWidgetPositions: { def: {} },
|
desktopWidgetPositions: { def: {} },
|
||||||
desktopWidgetGridSettings: { def: {} },
|
desktopWidgetGridSettings: { def: {} },
|
||||||
|
|
||||||
desktopWidgetInstances: { def: [] }
|
desktopWidgetInstances: { def: [] },
|
||||||
|
|
||||||
|
builtInPluginSettings: { def: {} }
|
||||||
};
|
};
|
||||||
|
|
||||||
function getValidKeys() {
|
function getValidKeys() {
|
||||||
|
|||||||
@@ -606,9 +606,7 @@ Item {
|
|||||||
|
|
||||||
active: false
|
active: false
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: PopoutService.processListModalLoader = processListModalLoader
|
||||||
PopoutService.processListModalLoader = processListModalLoader;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProcessListModal {
|
ProcessListModal {
|
||||||
id: processListModal
|
id: processListModal
|
||||||
@@ -646,17 +644,6 @@ Item {
|
|||||||
expandedWidthValue: 960
|
expandedWidthValue: 960
|
||||||
customTransparency: SettingsData.notepadTransparencyOverride
|
customTransparency: SettingsData.notepadTransparencyOverride
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
PopoutService.notepadSlideouts.push(notepadSlideout);
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onDestruction: {
|
|
||||||
const index = PopoutService.notepadSlideouts.indexOf(notepadSlideout);
|
|
||||||
if (index > -1) {
|
|
||||||
PopoutService.notepadSlideouts.splice(index, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
content: Component {
|
content: Component {
|
||||||
Notepad {
|
Notepad {
|
||||||
onHideRequested: {
|
onHideRequested: {
|
||||||
@@ -673,6 +660,9 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onInstancesChanged: PopoutService.notepadSlideouts = instances
|
||||||
|
Component.onCompleted: PopoutService.notepadSlideouts = instances
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyLoader {
|
LazyLoader {
|
||||||
|
|||||||
@@ -22,12 +22,8 @@ DankModal {
|
|||||||
function resetContent() {
|
function resetContent() {
|
||||||
if (!spotlightContent)
|
if (!spotlightContent)
|
||||||
return;
|
return;
|
||||||
if (spotlightContent.appLauncher) {
|
if (spotlightContent.appLauncher)
|
||||||
spotlightContent.appLauncher.suppressUpdatesWhileLaunching = false;
|
spotlightContent.appLauncher.reset();
|
||||||
spotlightContent.appLauncher.searchQuery = "";
|
|
||||||
spotlightContent.appLauncher.selectedIndex = 0;
|
|
||||||
spotlightContent.appLauncher.setCategory(I18n.tr("All"));
|
|
||||||
}
|
|
||||||
if (spotlightContent.fileSearchController)
|
if (spotlightContent.fileSearchController)
|
||||||
spotlightContent.fileSearchController.reset();
|
spotlightContent.fileSearchController.reset();
|
||||||
if (spotlightContent.resetScroll)
|
if (spotlightContent.resetScroll)
|
||||||
|
|||||||
@@ -96,7 +96,11 @@ Item {
|
|||||||
_updatingFromTrigger = true;
|
_updatingFromTrigger = true;
|
||||||
selectedCategory = triggerResult.pluginCategory;
|
selectedCategory = triggerResult.pluginCategory;
|
||||||
_updatingFromTrigger = false;
|
_updatingFromTrigger = false;
|
||||||
apps = AppSearchService.getPluginItems(triggerResult.pluginCategory, triggerResult.query);
|
if (triggerResult.isBuiltIn) {
|
||||||
|
apps = AppSearchService.getBuiltInLauncherItems(triggerResult.pluginId, triggerResult.query);
|
||||||
|
} else {
|
||||||
|
apps = AppSearchService.getPluginItems(triggerResult.pluginCategory, triggerResult.query);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_isTriggered) {
|
if (_isTriggered) {
|
||||||
_updatingFromTrigger = true;
|
_updatingFromTrigger = true;
|
||||||
@@ -114,7 +118,11 @@ Item {
|
|||||||
const items = AppSearchService.getPluginItems(pluginCategory, "");
|
const items = AppSearchService.getPluginItems(pluginCategory, "");
|
||||||
emptyTriggerItems = emptyTriggerItems.concat(items);
|
emptyTriggerItems = emptyTriggerItems.concat(items);
|
||||||
});
|
});
|
||||||
// Add Core Apps
|
const builtInEmptyTrigger = AppSearchService.getBuiltInLauncherPluginsWithEmptyTrigger();
|
||||||
|
builtInEmptyTrigger.forEach(pluginId => {
|
||||||
|
const items = AppSearchService.getBuiltInLauncherItems(pluginId, "");
|
||||||
|
emptyTriggerItems = emptyTriggerItems.concat(items);
|
||||||
|
});
|
||||||
const coreItems = AppSearchService.getCoreApps("");
|
const coreItems = AppSearchService.getCoreApps("");
|
||||||
apps = AppSearchService.applications.concat(emptyTriggerItems).concat(coreItems);
|
apps = AppSearchService.applications.concat(emptyTriggerItems).concat(coreItems);
|
||||||
} else {
|
} else {
|
||||||
@@ -133,6 +141,11 @@ Item {
|
|||||||
const items = AppSearchService.getPluginItems(pluginCategory, searchQuery);
|
const items = AppSearchService.getPluginItems(pluginCategory, searchQuery);
|
||||||
emptyTriggerItems = emptyTriggerItems.concat(items);
|
emptyTriggerItems = emptyTriggerItems.concat(items);
|
||||||
});
|
});
|
||||||
|
const builtInEmptyTrigger = AppSearchService.getBuiltInLauncherPluginsWithEmptyTrigger();
|
||||||
|
builtInEmptyTrigger.forEach(pluginId => {
|
||||||
|
const items = AppSearchService.getBuiltInLauncherItems(pluginId, searchQuery);
|
||||||
|
emptyTriggerItems = emptyTriggerItems.concat(items);
|
||||||
|
});
|
||||||
|
|
||||||
const coreItems = AppSearchService.getCoreApps(searchQuery);
|
const coreItems = AppSearchService.getCoreApps(searchQuery);
|
||||||
apps = apps.concat(emptyTriggerItems).concat(coreItems);
|
apps = apps.concat(emptyTriggerItems).concat(coreItems);
|
||||||
@@ -191,6 +204,7 @@ Item {
|
|||||||
"categories": app.categories || [],
|
"categories": app.categories || [],
|
||||||
"isPlugin": isPluginItem,
|
"isPlugin": isPluginItem,
|
||||||
"isCore": app.isCore === true,
|
"isCore": app.isCore === true,
|
||||||
|
"isBuiltInLauncher": app.isBuiltInLauncher === true,
|
||||||
"appIndex": uniqueApps.length - 1
|
"appIndex": uniqueApps.length - 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -240,13 +254,18 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function launchApp(appData) {
|
function launchApp(appData) {
|
||||||
if (!appData || typeof appData.appIndex === "undefined" || appData.appIndex < 0 || appData.appIndex >= _uniqueApps.length) {
|
if (!appData || typeof appData.appIndex === "undefined" || appData.appIndex < 0 || appData.appIndex >= _uniqueApps.length)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
suppressUpdatesWhileLaunching = true;
|
suppressUpdatesWhileLaunching = true;
|
||||||
|
|
||||||
const actualApp = _uniqueApps[appData.appIndex];
|
const actualApp = _uniqueApps[appData.appIndex];
|
||||||
|
|
||||||
|
if (appData.isBuiltInLauncher) {
|
||||||
|
AppSearchService.executeBuiltInLauncherItem(actualApp);
|
||||||
|
appLaunched(appData);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (appData.isCore) {
|
if (appData.isCore) {
|
||||||
AppSearchService.executeCoreApp(actualApp);
|
AppSearchService.executeCoreApp(actualApp);
|
||||||
appLaunched(appData);
|
appLaunched(appData);
|
||||||
@@ -260,11 +279,20 @@ Item {
|
|||||||
appLaunched(appData);
|
appLaunched(appData);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
return;
|
||||||
SessionService.launchDesktopEntry(actualApp);
|
|
||||||
appLaunched(appData);
|
|
||||||
AppUsageHistoryData.addAppUsage(actualApp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SessionService.launchDesktopEntry(actualApp);
|
||||||
|
appLaunched(appData);
|
||||||
|
AppUsageHistoryData.addAppUsage(actualApp);
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
suppressUpdatesWhileLaunching = false;
|
||||||
|
searchQuery = "";
|
||||||
|
selectedIndex = 0;
|
||||||
|
setCategory(I18n.tr("All"));
|
||||||
|
updateFilteredModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCategory(category) {
|
function setCategory(category) {
|
||||||
@@ -320,42 +348,50 @@ Item {
|
|||||||
onTriggered: updateFilteredModel()
|
onTriggered: updateFilteredModel()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugin trigger system functions
|
|
||||||
function checkPluginTriggers(query) {
|
function checkPluginTriggers(query) {
|
||||||
if (!query || typeof PluginService === "undefined") {
|
if (!query)
|
||||||
|
return { triggered: false, pluginCategory: "", query: "" };
|
||||||
|
|
||||||
|
const builtInTriggers = AppSearchService.getBuiltInLauncherTriggers();
|
||||||
|
for (const trigger in builtInTriggers) {
|
||||||
|
if (!query.startsWith(trigger))
|
||||||
|
continue;
|
||||||
|
const pluginId = builtInTriggers[trigger];
|
||||||
|
const plugin = AppSearchService.builtInPlugins[pluginId];
|
||||||
|
if (!plugin)
|
||||||
|
continue;
|
||||||
return {
|
return {
|
||||||
triggered: false,
|
triggered: true,
|
||||||
pluginCategory: "",
|
pluginId: pluginId,
|
||||||
query: ""
|
pluginCategory: plugin.name,
|
||||||
|
query: query.substring(trigger.length).trim(),
|
||||||
|
trigger: trigger,
|
||||||
|
isBuiltIn: true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof PluginService === "undefined")
|
||||||
|
return { triggered: false, pluginCategory: "", query: "" };
|
||||||
|
|
||||||
const triggers = PluginService.getAllPluginTriggers();
|
const triggers = PluginService.getAllPluginTriggers();
|
||||||
|
|
||||||
for (const trigger in triggers) {
|
for (const trigger in triggers) {
|
||||||
if (query.startsWith(trigger)) {
|
if (!query.startsWith(trigger))
|
||||||
const pluginId = triggers[trigger];
|
continue;
|
||||||
const plugin = PluginService.getLauncherPlugin(pluginId);
|
const pluginId = triggers[trigger];
|
||||||
|
const plugin = PluginService.getLauncherPlugin(pluginId);
|
||||||
if (plugin) {
|
if (!plugin)
|
||||||
const remainingQuery = query.substring(trigger.length).trim();
|
continue;
|
||||||
const result = {
|
return {
|
||||||
triggered: true,
|
triggered: true,
|
||||||
pluginId: pluginId,
|
pluginId: pluginId,
|
||||||
pluginCategory: plugin.name || pluginId,
|
pluginCategory: plugin.name || pluginId,
|
||||||
query: remainingQuery,
|
query: query.substring(trigger.length).trim(),
|
||||||
trigger: trigger
|
trigger: trigger,
|
||||||
};
|
isBuiltIn: false
|
||||||
return result;
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return { triggered: false, pluginCategory: "", query: "" };
|
||||||
triggered: false,
|
|
||||||
pluginCategory: "",
|
|
||||||
query: ""
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPluginIdForItem(item) {
|
function getPluginIdForItem(item) {
|
||||||
|
|||||||
@@ -378,6 +378,90 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SettingsCard {
|
||||||
|
id: builtInPluginsCard
|
||||||
|
width: parent.width
|
||||||
|
iconName: "extension"
|
||||||
|
title: "DMS"
|
||||||
|
settingKey: "builtInPlugins"
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: ["dms_settings", "dms_notepad", "dms_sysmon", "dms_settings_search"]
|
||||||
|
|
||||||
|
delegate: Rectangle {
|
||||||
|
id: pluginDelegate
|
||||||
|
required property string modelData
|
||||||
|
required property int index
|
||||||
|
readonly property var plugin: AppSearchService.builtInPlugins[modelData]
|
||||||
|
|
||||||
|
width: parent.width
|
||||||
|
height: 56
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.3)
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.spacingM
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: pluginDelegate.plugin?.cornerIcon ?? "extension"
|
||||||
|
size: Theme.iconSize
|
||||||
|
color: Theme.primary
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: pluginDelegate.plugin?.name ?? pluginDelegate.modelData
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: pluginDelegate.plugin?.comment ?? ""
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: Theme.spacingM
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: triggerField
|
||||||
|
width: 60
|
||||||
|
visible: pluginDelegate.plugin?.isLauncher === true
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
placeholderText: I18n.tr("Trigger")
|
||||||
|
onTextEdited: SettingsData.setBuiltInPluginSetting(pluginDelegate.modelData, "trigger", text)
|
||||||
|
Component.onCompleted: text = SettingsData.getBuiltInPluginSetting(pluginDelegate.modelData, "trigger", pluginDelegate.plugin?.defaultTrigger ?? "")
|
||||||
|
}
|
||||||
|
|
||||||
|
DankToggle {
|
||||||
|
id: enableToggle
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
checked: SettingsData.getBuiltInPluginSetting(pluginDelegate.modelData, "enabled", true)
|
||||||
|
onToggled: SettingsData.setBuiltInPluginSetting(pluginDelegate.modelData, "enabled", checked)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SettingsCard {
|
SettingsCard {
|
||||||
id: recentAppsCard
|
id: recentAppsCard
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|||||||
@@ -42,64 +42,179 @@ Singleton {
|
|||||||
_cachedCategories = null;
|
_cachedCategories = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property var coreApps: [
|
readonly property string dmsLogoPath: Qt.resolvedUrl("../assets/danklogo2.svg")
|
||||||
{
|
|
||||||
name: I18n.tr("DMS"),
|
readonly property var builtInPlugins: ({
|
||||||
icon: "svg:../assets/danklogo2.svg",
|
"dms_settings": {
|
||||||
comment: I18n.tr("Settings"),
|
id: "dms_settings",
|
||||||
action: "ipc:settings",
|
name: I18n.tr("Settings", "settings window title"),
|
||||||
categories: ["Settings", "System"],
|
icon: "svg+corner:" + dmsLogoPath + "|settings",
|
||||||
isCore: true
|
cornerIcon: "settings",
|
||||||
},
|
comment: "DMS",
|
||||||
{
|
action: "ipc:settings",
|
||||||
name: I18n.tr("DMS"),
|
categories: ["Settings", "System"],
|
||||||
icon: "material:description",
|
defaultTrigger: "",
|
||||||
comment: I18n.tr("Notepad"),
|
isLauncher: false
|
||||||
action: "ipc:notepad",
|
},
|
||||||
categories: ["Office", "Utility"],
|
"dms_notepad": {
|
||||||
isCore: true
|
id: "dms_notepad",
|
||||||
},
|
name: I18n.tr("Notepad", "Notepad"),
|
||||||
{
|
icon: "svg+corner:" + dmsLogoPath + "|description",
|
||||||
name: I18n.tr("DMS"),
|
cornerIcon: "description",
|
||||||
icon: "material:monitor_heart",
|
comment: "DMS",
|
||||||
comment: I18n.tr("System Monitor"),
|
action: "ipc:notepad",
|
||||||
action: "ipc:processlist",
|
categories: ["Office", "Utility"],
|
||||||
categories: ["System", "Monitor"],
|
defaultTrigger: "",
|
||||||
isCore: true
|
isLauncher: false
|
||||||
|
},
|
||||||
|
"dms_sysmon": {
|
||||||
|
id: "dms_sysmon",
|
||||||
|
name: I18n.tr("System Monitor", "sysmon window title"),
|
||||||
|
icon: "svg+corner:" + dmsLogoPath + "|monitor_heart",
|
||||||
|
cornerIcon: "monitor_heart",
|
||||||
|
comment: "DMS",
|
||||||
|
action: "ipc:processlist",
|
||||||
|
categories: ["System", "Monitor"],
|
||||||
|
defaultTrigger: "",
|
||||||
|
isLauncher: false
|
||||||
|
},
|
||||||
|
"dms_settings_search": {
|
||||||
|
id: "dms_settings_search",
|
||||||
|
name: I18n.tr("Settings", "settings window title"),
|
||||||
|
cornerIcon: "search",
|
||||||
|
comment: "DMS",
|
||||||
|
defaultTrigger: "?",
|
||||||
|
isLauncher: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function getBuiltInPluginTrigger(pluginId) {
|
||||||
|
const plugin = builtInPlugins[pluginId];
|
||||||
|
if (!plugin)
|
||||||
|
return null;
|
||||||
|
return SettingsData.getBuiltInPluginSetting(pluginId, "trigger", plugin.defaultTrigger);
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly property var coreApps: {
|
||||||
|
SettingsData.builtInPluginSettings;
|
||||||
|
const apps = [];
|
||||||
|
for (const pluginId in builtInPlugins) {
|
||||||
|
if (!SettingsData.getBuiltInPluginSetting(pluginId, "enabled", true))
|
||||||
|
continue;
|
||||||
|
const plugin = builtInPlugins[pluginId];
|
||||||
|
if (plugin.isLauncher)
|
||||||
|
continue;
|
||||||
|
apps.push({
|
||||||
|
name: plugin.name,
|
||||||
|
icon: plugin.icon,
|
||||||
|
comment: plugin.comment,
|
||||||
|
action: plugin.action,
|
||||||
|
categories: plugin.categories,
|
||||||
|
isCore: true,
|
||||||
|
builtInPluginId: pluginId
|
||||||
|
});
|
||||||
}
|
}
|
||||||
]
|
return apps;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBuiltInLauncherPlugins() {
|
||||||
|
const result = {};
|
||||||
|
for (const pluginId in builtInPlugins) {
|
||||||
|
const plugin = builtInPlugins[pluginId];
|
||||||
|
if (!plugin.isLauncher)
|
||||||
|
continue;
|
||||||
|
if (!SettingsData.getBuiltInPluginSetting(pluginId, "enabled", true))
|
||||||
|
continue;
|
||||||
|
result[pluginId] = plugin;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBuiltInLauncherTriggers() {
|
||||||
|
const triggers = {};
|
||||||
|
const launchers = getBuiltInLauncherPlugins();
|
||||||
|
for (const pluginId in launchers) {
|
||||||
|
const trigger = getBuiltInPluginTrigger(pluginId);
|
||||||
|
if (trigger && trigger.trim() !== "")
|
||||||
|
triggers[trigger] = pluginId;
|
||||||
|
}
|
||||||
|
return triggers;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBuiltInLauncherPluginsWithEmptyTrigger() {
|
||||||
|
const result = [];
|
||||||
|
const launchers = getBuiltInLauncherPlugins();
|
||||||
|
for (const pluginId in launchers) {
|
||||||
|
const trigger = getBuiltInPluginTrigger(pluginId);
|
||||||
|
if (!trigger || trigger.trim() === "")
|
||||||
|
result.push(pluginId);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBuiltInLauncherItems(pluginId, query) {
|
||||||
|
if (pluginId !== "dms_settings_search")
|
||||||
|
return [];
|
||||||
|
|
||||||
|
SettingsSearchService.search(query);
|
||||||
|
const results = SettingsSearchService.results;
|
||||||
|
const items = [];
|
||||||
|
for (let i = 0; i < results.length; i++) {
|
||||||
|
const r = results[i];
|
||||||
|
items.push({
|
||||||
|
name: r.label,
|
||||||
|
icon: "material:" + r.icon,
|
||||||
|
comment: r.category,
|
||||||
|
action: "settings_nav:" + r.tabIndex + ":" + r.section,
|
||||||
|
categories: ["Settings"],
|
||||||
|
isCore: true,
|
||||||
|
isBuiltInLauncher: true,
|
||||||
|
builtInPluginId: pluginId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
function executeBuiltInLauncherItem(item) {
|
||||||
|
if (!item?.action)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const parts = item.action.split(":");
|
||||||
|
if (parts[0] !== "settings_nav")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const tabIndex = parseInt(parts[1]);
|
||||||
|
const section = parts.slice(2).join(":");
|
||||||
|
SettingsSearchService.navigateToSection(section);
|
||||||
|
PopoutService.openSettingsWithTabIndex(tabIndex);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function getCoreApps(query) {
|
function getCoreApps(query) {
|
||||||
if (!query || query.length === 0) {
|
if (!query || query.length === 0)
|
||||||
return coreApps;
|
return coreApps;
|
||||||
}
|
|
||||||
|
|
||||||
const lowerQuery = query.toLowerCase();
|
const lowerQuery = query.toLowerCase();
|
||||||
return coreApps.filter(app => {
|
return coreApps.filter(app => app.name.toLowerCase().includes(lowerQuery) || app.comment.toLowerCase().includes(lowerQuery));
|
||||||
return app.name.toLowerCase().includes(lowerQuery) || app.comment.toLowerCase().includes(lowerQuery);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function executeCoreApp(app) {
|
function executeCoreApp(app) {
|
||||||
if (!app || !app.action) {
|
if (!app?.action)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
const actionParts = app.action.split(":");
|
const parts = app.action.split(":");
|
||||||
const actionType = actionParts[0];
|
if (parts[0] !== "ipc")
|
||||||
const actionTarget = actionParts[1];
|
return false;
|
||||||
|
|
||||||
if (actionType === "ipc") {
|
switch (parts[1]) {
|
||||||
if (actionTarget === "settings") {
|
case "settings":
|
||||||
PopoutService.focusOrToggleSettings();
|
PopoutService.focusOrToggleSettings();
|
||||||
return true;
|
return true;
|
||||||
} else if (actionTarget === "notepad") {
|
case "notepad":
|
||||||
PopoutService.toggleNotepad();
|
PopoutService.openNotepad();
|
||||||
return true;
|
return true;
|
||||||
} else if (actionTarget === "processlist") {
|
case "processlist":
|
||||||
PopoutService.toggleProcessListModal();
|
PopoutService.showProcessListModal();
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ Singleton {
|
|||||||
property bool _settingsWantsToggle: false
|
property bool _settingsWantsToggle: false
|
||||||
|
|
||||||
property string _settingsPendingTab: ""
|
property string _settingsPendingTab: ""
|
||||||
|
property int _settingsPendingTabIndex: -1
|
||||||
|
|
||||||
function openSettings() {
|
function openSettings() {
|
||||||
if (settingsModal) {
|
if (settingsModal) {
|
||||||
@@ -226,6 +227,19 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openSettingsWithTabIndex(tabIndex: int) {
|
||||||
|
if (settingsModal) {
|
||||||
|
settingsModal.showWithTab(tabIndex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (settingsModalLoader) {
|
||||||
|
_settingsPendingTabIndex = tabIndex;
|
||||||
|
_settingsWantsOpen = true;
|
||||||
|
_settingsWantsToggle = false;
|
||||||
|
settingsModalLoader.activeAsync = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function closeSettings() {
|
function closeSettings() {
|
||||||
settingsModal?.close();
|
settingsModal?.close();
|
||||||
}
|
}
|
||||||
@@ -303,7 +317,10 @@ Singleton {
|
|||||||
function _onSettingsModalLoaded() {
|
function _onSettingsModalLoaded() {
|
||||||
if (_settingsWantsOpen) {
|
if (_settingsWantsOpen) {
|
||||||
_settingsWantsOpen = false;
|
_settingsWantsOpen = false;
|
||||||
if (_settingsPendingTab) {
|
if (_settingsPendingTabIndex >= 0) {
|
||||||
|
settingsModal?.showWithTab(_settingsPendingTabIndex);
|
||||||
|
_settingsPendingTabIndex = -1;
|
||||||
|
} else if (_settingsPendingTab) {
|
||||||
settingsModal?.showWithTabName(_settingsPendingTab);
|
settingsModal?.showWithTabName(_settingsPendingTab);
|
||||||
_settingsPendingTab = "";
|
_settingsPendingTab = "";
|
||||||
} else {
|
} else {
|
||||||
@@ -313,7 +330,10 @@ Singleton {
|
|||||||
}
|
}
|
||||||
if (_settingsWantsToggle) {
|
if (_settingsWantsToggle) {
|
||||||
_settingsWantsToggle = false;
|
_settingsWantsToggle = false;
|
||||||
if (_settingsPendingTab) {
|
if (_settingsPendingTabIndex >= 0) {
|
||||||
|
settingsModal.currentTabIndex = _settingsPendingTabIndex;
|
||||||
|
_settingsPendingTabIndex = -1;
|
||||||
|
} else if (_settingsPendingTab) {
|
||||||
var idx = settingsModal?.resolveTabIndex(_settingsPendingTab) ?? -1;
|
var idx = settingsModal?.resolveTabIndex(_settingsPendingTab) ?? -1;
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
settingsModal.currentTabIndex = idx;
|
settingsModal.currentTabIndex = idx;
|
||||||
@@ -358,10 +378,12 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showProcessListModal() {
|
function showProcessListModal() {
|
||||||
if (processListModalLoader) {
|
if (processListModal) {
|
||||||
|
processListModal.show();
|
||||||
|
} else if (processListModalLoader) {
|
||||||
processListModalLoader.active = true;
|
processListModalLoader.active = true;
|
||||||
|
Qt.callLater(() => processListModal?.show());
|
||||||
}
|
}
|
||||||
processListModal?.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideProcessListModal() {
|
function hideProcessListModal() {
|
||||||
@@ -369,10 +391,12 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function toggleProcessListModal() {
|
function toggleProcessListModal() {
|
||||||
if (processListModalLoader) {
|
if (processListModal) {
|
||||||
|
processListModal.toggle();
|
||||||
|
} else if (processListModalLoader) {
|
||||||
processListModalLoader.active = true;
|
processListModalLoader.active = true;
|
||||||
|
Qt.callLater(() => processListModal?.show());
|
||||||
}
|
}
|
||||||
processListModal?.toggle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showColorPicker() {
|
function showColorPicker() {
|
||||||
|
|||||||
@@ -24,13 +24,21 @@ Item {
|
|||||||
|
|
||||||
readonly property bool isMaterial: iconValue.startsWith("material:")
|
readonly property bool isMaterial: iconValue.startsWith("material:")
|
||||||
readonly property bool isUnicode: iconValue.startsWith("unicode:")
|
readonly property bool isUnicode: iconValue.startsWith("unicode:")
|
||||||
readonly property bool isSvg: iconValue.startsWith("svg:")
|
readonly property bool isSvgCorner: iconValue.startsWith("svg+corner:")
|
||||||
|
readonly property bool isSvg: !isSvgCorner && iconValue.startsWith("svg:")
|
||||||
readonly property string materialName: isMaterial ? iconValue.substring(9) : ""
|
readonly property string materialName: isMaterial ? iconValue.substring(9) : ""
|
||||||
readonly property string unicodeChar: isUnicode ? iconValue.substring(8) : ""
|
readonly property string unicodeChar: isUnicode ? iconValue.substring(8) : ""
|
||||||
readonly property string svgPath: isSvg ? iconValue.substring(4) : ""
|
readonly property string svgSource: {
|
||||||
readonly property bool isFileUrl: iconValue.startsWith("file://") || iconValue.startsWith("qrc:/")
|
if (isSvgCorner) {
|
||||||
readonly property string iconPath: (isMaterial || isUnicode || isSvg || isFileUrl) ? "" : Quickshell.iconPath(iconValue, true) || DesktopService.resolveIconPath(iconValue)
|
const parts = iconValue.substring(11).split("|");
|
||||||
readonly property string resolvedIconPath: isSvg ? Qt.resolvedUrl(svgPath) : (isFileUrl ? iconValue : iconPath)
|
return parts[0] || "";
|
||||||
|
}
|
||||||
|
if (isSvg)
|
||||||
|
return iconValue.substring(4);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
readonly property string svgCornerIcon: isSvgCorner ? (iconValue.substring(11).split("|")[1] || "") : ""
|
||||||
|
readonly property string iconPath: isMaterial || isUnicode || isSvg || isSvgCorner ? "" : Quickshell.iconPath(iconValue, true) || DesktopService.resolveIconPath(iconValue)
|
||||||
|
|
||||||
visible: iconValue !== undefined && iconValue !== ""
|
visible: iconValue !== undefined && iconValue !== ""
|
||||||
|
|
||||||
@@ -50,19 +58,12 @@ Item {
|
|||||||
visible: root.isUnicode
|
visible: root.isUnicode
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
DankSVGIcon {
|
||||||
id: svgOrFileUrlImg
|
anchors.centerIn: parent
|
||||||
|
source: root.svgSource
|
||||||
anchors.fill: parent
|
size: root.iconSize
|
||||||
source: root.resolvedIconPath
|
cornerIcon: root.svgCornerIcon
|
||||||
sourceSize.width: root.iconSize * 2
|
visible: root.isSvg || root.isSvgCorner
|
||||||
sourceSize.height: root.iconSize * 2
|
|
||||||
smooth: true
|
|
||||||
mipmap: true
|
|
||||||
asynchronous: true
|
|
||||||
cache: true
|
|
||||||
fillMode: Image.PreserveAspectFit
|
|
||||||
visible: (root.isSvg || root.isFileUrl) && status === Image.Ready
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IconImage {
|
IconImage {
|
||||||
@@ -72,7 +73,7 @@ Item {
|
|||||||
source: root.iconPath
|
source: root.iconPath
|
||||||
smooth: true
|
smooth: true
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
visible: !root.isMaterial && !root.isUnicode && !root.isSvg && !root.isFileUrl && root.iconPath !== "" && status === Image.Ready
|
visible: !root.isMaterial && !root.isUnicode && !root.isSvg && !root.isSvgCorner && root.iconPath !== "" && status === Image.Ready
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -83,7 +84,7 @@ Item {
|
|||||||
anchors.rightMargin: root.fallbackRightMargin
|
anchors.rightMargin: root.fallbackRightMargin
|
||||||
anchors.topMargin: root.fallbackTopMargin
|
anchors.topMargin: root.fallbackTopMargin
|
||||||
anchors.bottomMargin: root.fallbackBottomMargin
|
anchors.bottomMargin: root.fallbackBottomMargin
|
||||||
visible: !root.isMaterial && !root.isUnicode && !root.isSvg && !root.isFileUrl && (root.iconPath === "" || iconImg.status !== Image.Ready)
|
visible: !root.isMaterial && !root.isUnicode && !root.isSvg && !root.isSvgCorner && (root.iconPath === "" || iconImg.status !== Image.Ready)
|
||||||
color: root.fallbackBackgroundColor
|
color: root.fallbackBackgroundColor
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
border.width: 0
|
border.width: 0
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import QtQuick
|
|||||||
import QtQuick.Effects
|
import QtQuick.Effects
|
||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Widgets
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@@ -36,18 +35,17 @@ Item {
|
|||||||
implicitWidth: size
|
implicitWidth: size
|
||||||
implicitHeight: size
|
implicitHeight: size
|
||||||
|
|
||||||
Image {
|
IconImage {
|
||||||
id: iconImage
|
id: iconImage
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: root.resolvedSource
|
source: root.resolvedSource
|
||||||
sourceSize.width: root.size * 2
|
|
||||||
sourceSize.height: root.size * 2
|
|
||||||
smooth: true
|
smooth: true
|
||||||
mipmap: true
|
mipmap: true
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
cache: true
|
implicitSize: root.size * 2
|
||||||
fillMode: Image.PreserveAspectFit
|
backer.sourceSize.width: root.size * 2
|
||||||
|
backer.sourceSize.height: root.size * 2
|
||||||
|
backer.cache: true
|
||||||
layer.enabled: root.hasColorEffect
|
layer.enabled: root.hasColorEffect
|
||||||
layer.smooth: true
|
layer.smooth: true
|
||||||
layer.mipmap: true
|
layer.mipmap: true
|
||||||
|
|||||||
Reference in New Issue
Block a user