mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
feat: Pinnable DMS coreApps w/Color options
This commit is contained in:
@@ -76,8 +76,6 @@ FocusScope {
|
||||
function showContextMenu(item, x, y, fromKeyboard) {
|
||||
if (!item)
|
||||
return;
|
||||
if (item.isCore)
|
||||
return;
|
||||
if (!contextMenu.hasContextMenuActions(item))
|
||||
return;
|
||||
contextMenu.show(x, y, item, fromKeyboard);
|
||||
|
||||
@@ -20,7 +20,7 @@ Popup {
|
||||
function hasContextMenuActions(spotlightItem) {
|
||||
if (!spotlightItem)
|
||||
return false;
|
||||
if (spotlightItem.type === "app" && !spotlightItem.isCore)
|
||||
if (spotlightItem.type === "app")
|
||||
return true;
|
||||
if (spotlightItem.type === "plugin" && spotlightItem.pluginId) {
|
||||
var instance = PluginService.pluginInstances[spotlightItem.pluginId];
|
||||
@@ -34,9 +34,16 @@ Popup {
|
||||
return false;
|
||||
}
|
||||
|
||||
readonly property var desktopEntry: item?.data ?? null
|
||||
readonly property string appId: desktopEntry?.id || desktopEntry?.execString || ""
|
||||
readonly property bool isPinned: SessionData.isPinnedApp(appId)
|
||||
readonly property bool isCoreApp: item?.type === "app" && item?.isCore
|
||||
readonly property var coreAppData: isCoreApp ? item?.data ?? null : null
|
||||
readonly property var desktopEntry: !isCoreApp ? (item?.data ?? null) : null
|
||||
readonly property string appId: {
|
||||
if (isCoreApp) {
|
||||
return item?.id || coreAppData?.builtInPluginId || "";
|
||||
}
|
||||
return desktopEntry?.id || desktopEntry?.execString || "";
|
||||
}
|
||||
readonly property bool isPinned: appId ? SessionData.isPinnedApp(appId) : false
|
||||
readonly property bool isRegularApp: item?.type === "app" && !item.isCore && desktopEntry
|
||||
readonly property bool isPluginItem: item?.type === "plugin"
|
||||
|
||||
@@ -82,15 +89,14 @@ Popup {
|
||||
return items;
|
||||
}
|
||||
|
||||
if (!desktopEntry)
|
||||
return items;
|
||||
|
||||
items.push({
|
||||
type: "item",
|
||||
icon: isPinned ? "keep_off" : "push_pin",
|
||||
text: isPinned ? I18n.tr("Unpin from Dock") : I18n.tr("Pin to Dock"),
|
||||
action: togglePin
|
||||
});
|
||||
if (item?.type === "app") {
|
||||
items.push({
|
||||
type: "item",
|
||||
icon: isPinned ? "keep_off" : "push_pin",
|
||||
text: isPinned ? I18n.tr("Unpin from Dock") : I18n.tr("Pin to Dock"),
|
||||
action: togglePin
|
||||
});
|
||||
}
|
||||
|
||||
if (isRegularApp) {
|
||||
items.push({
|
||||
@@ -200,6 +206,14 @@ Popup {
|
||||
}
|
||||
|
||||
function launchApp() {
|
||||
if (isCoreApp) {
|
||||
if (!coreAppData)
|
||||
return;
|
||||
AppSearchService.executeCoreApp(coreAppData);
|
||||
controller?.itemExecuted();
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
if (!desktopEntry)
|
||||
return;
|
||||
SessionService.launchDesktopEntry(desktopEntry);
|
||||
|
||||
Reference in New Issue
Block a user