1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-26 22:42:50 -05:00

launcher: Dank Launcher V2 (beta)

- Aggregate plugins/extensions in new "all" tab
- Quick tab actions
- New tile mode for results
- Plugins can enforce/require view mode, or set preferred default
- Danksearch under "files" category
This commit is contained in:
bbedward
2026-01-20 17:54:30 -05:00
parent 3c39162016
commit 1d5d876e16
31 changed files with 5778 additions and 216 deletions

View File

@@ -13,6 +13,12 @@ Singleton {
property var _cachedVisibleApps: null
property var _hiddenAppsSet: new Set()
property var _transformCache: ({})
property var _cachedDefaultSections: []
property var _cachedDefaultFlatModel: []
property bool _defaultCacheValid: false
property int cacheVersion: 0
readonly property int maxResults: 10
readonly property int frecencySampleSize: 10
@@ -43,6 +49,50 @@ Singleton {
applications = DesktopEntries.applications.values;
_cachedCategories = null;
_cachedVisibleApps = null;
invalidateLauncherCache();
}
function invalidateLauncherCache() {
_transformCache = {};
_defaultCacheValid = false;
_cachedDefaultSections = [];
_cachedDefaultFlatModel = [];
cacheVersion++;
}
function getOrTransformApp(app, transformFn) {
const id = app.id || app.execString || app.exec || "";
if (!id)
return transformFn(app);
const cached = _transformCache[id];
if (cached) {
const currentIcon = app.icon || "";
const cachedSourceIcon = cached._sourceIcon || "";
if (currentIcon === cachedSourceIcon)
return cached;
}
const transformed = transformFn(app);
transformed._sourceIcon = app.icon || "";
_transformCache[id] = transformed;
return transformed;
}
function getCachedDefaultSections() {
if (!_defaultCacheValid)
return null;
return _cachedDefaultSections;
}
function setCachedDefaultSections(sections, flatModel) {
_cachedDefaultSections = sections.map(function (s) {
return Object.assign({}, s);
});
_cachedDefaultFlatModel = flatModel.slice();
_defaultCacheValid = true;
}
function isCacheValid() {
return _defaultCacheValid;
}
function _rebuildHiddenSet() {
@@ -68,9 +118,18 @@ Singleton {
target: SessionData
function onHiddenAppsChanged() {
root._rebuildHiddenSet();
root.invalidateLauncherCache();
}
function onAppOverridesChanged() {
root._cachedVisibleApps = null;
root.invalidateLauncherCache();
}
}
Connections {
target: AppUsageHistoryData
function onAppUsageRankingChanged() {
root.invalidateLauncherCache();
}
}