mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-04 04:42:05 -04:00
launcher v2: always heuristicLookup tab actions
This commit is contained in:
@@ -56,11 +56,6 @@ Rectangle {
|
||||
case "app":
|
||||
if (selectedItem?.isCore)
|
||||
break;
|
||||
if (selectedItem?.actions) {
|
||||
for (var i = 0; i < selectedItem.actions.length; i++) {
|
||||
result.push(selectedItem.actions[i]);
|
||||
}
|
||||
}
|
||||
if (SessionService.nvidiaCommand) {
|
||||
result.push({
|
||||
name: I18n.tr("Launch on dGPU"),
|
||||
@@ -68,6 +63,11 @@ Rectangle {
|
||||
action: "launch_dgpu"
|
||||
});
|
||||
}
|
||||
if (selectedItem?.actions) {
|
||||
for (var i = 0; i < selectedItem.actions.length; i++) {
|
||||
result.push(selectedItem.actions[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -1250,6 +1250,23 @@ Item {
|
||||
CacheData.saveLauncherCache(serializable);
|
||||
}
|
||||
|
||||
function _actionsFromDesktopEntry(appId) {
|
||||
if (!appId)
|
||||
return [];
|
||||
var entry = DesktopEntries.heuristicLookup(appId);
|
||||
if (!entry || !entry.actions || entry.actions.length === 0)
|
||||
return [];
|
||||
var result = [];
|
||||
for (var i = 0; i < entry.actions.length; i++) {
|
||||
result.push({
|
||||
name: entry.actions[i].name,
|
||||
icon: "play_arrow",
|
||||
actionData: entry.actions[i]
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function _loadDiskCache() {
|
||||
var cached = CacheData.loadLauncherCache();
|
||||
if (!cached || !Array.isArray(cached) || cached.length === 0)
|
||||
@@ -1277,8 +1294,12 @@ Item {
|
||||
data: {
|
||||
id: it.id
|
||||
},
|
||||
actions: [],
|
||||
primaryAction: null,
|
||||
actions: _actionsFromDesktopEntry(it.id),
|
||||
primaryAction: it.type === "app" && !it.isCore ? {
|
||||
name: I18n.tr("Launch"),
|
||||
icon: "open_in_new",
|
||||
action: "launch"
|
||||
} : null,
|
||||
_diskCached: true,
|
||||
_hName: "",
|
||||
_hSub: "",
|
||||
|
||||
Reference in New Issue
Block a user