diff options
| author | AlexanderCurl <alexc@alexc.hu> | 2026-04-18 17:46:06 +0100 |
|---|---|---|
| committer | AlexanderCurl <alexc@alexc.hu> | 2026-04-18 17:46:06 +0100 |
| commit | 70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69 (patch) | |
| tree | ab1123d4067c1b086dd6faa7ee4ea643236b565a /raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Common/AppUsageHistoryData.qml | |
| parent | 5d94c0a7d44a2255b81815a52a7056a94a39842d (diff) | |
| download | RaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.tar.gz RaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.zip | |
Replaced file structures for themes in the correct format
Diffstat (limited to 'raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Common/AppUsageHistoryData.qml')
| -rw-r--r-- | raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Common/AppUsageHistoryData.qml | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Common/AppUsageHistoryData.qml b/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Common/AppUsageHistoryData.qml deleted file mode 100644 index 1077f38..0000000 --- a/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Common/AppUsageHistoryData.qml +++ /dev/null @@ -1,123 +0,0 @@ -pragma Singleton -pragma ComponentBehavior: Bound - -import QtCore -import QtQuick -import Quickshell -import Quickshell.Io - -Singleton { - id: root - - property var appUsageRanking: {} - property bool _saving: false - - Component.onCompleted: { - loadSettings(); - } - - function loadSettings() { - parseSettings(settingsFile.text()); - } - - function parseSettings(content) { - try { - if (content && content.trim()) { - var settings = JSON.parse(content); - appUsageRanking = settings.appUsageRanking || {}; - } - } catch (e) {} - } - - function saveSettings() { - settingsFile.setText(JSON.stringify({ - "appUsageRanking": appUsageRanking - }, null, 2)); - } - - function addAppUsage(app) { - if (!app) - return; - var appId = app.id || (app.execString || app.exec || ""); - if (!appId) - return; - var currentRanking = Object.assign({}, appUsageRanking); - - if (currentRanking[appId]) { - currentRanking[appId].usageCount = (currentRanking[appId].usageCount || 1) + 1; - currentRanking[appId].lastUsed = Date.now(); - currentRanking[appId].icon = app.icon ? String(app.icon) : (currentRanking[appId].icon || "application-x-executable"); - currentRanking[appId].name = app.name || currentRanking[appId].name || ""; - } else { - currentRanking[appId] = { - "name": app.name || "", - "exec": app.execString || app.exec || "", - "icon": app.icon ? String(app.icon) : "application-x-executable", - "comment": app.comment || "", - "usageCount": 1, - "lastUsed": Date.now() - }; - } - - appUsageRanking = currentRanking; - _saving = true; - saveSettings(); - _saving = false; - } - - function getRankedApps() { - var apps = []; - for (var appId in appUsageRanking) { - var appData = appUsageRanking[appId]; - apps.push({ - "id": appId, - "name": appData.name, - "exec": appData.exec, - "icon": appData.icon, - "comment": appData.comment, - "usageCount": appData.usageCount, - "lastUsed": appData.lastUsed - }); - } - - return apps.sort(function (a, b) { - if (a.usageCount !== b.usageCount) - return b.usageCount - a.usageCount; - return a.name.localeCompare(b.name); - }); - } - - function cleanupAppUsageRanking(availableAppIds) { - var currentRanking = Object.assign({}, appUsageRanking); - var hasChanges = false; - - for (var appId in currentRanking) { - if (availableAppIds.indexOf(appId) === -1) { - delete currentRanking[appId]; - hasChanges = true; - } - } - - if (hasChanges) { - appUsageRanking = currentRanking; - _saving = true; - saveSettings(); - _saving = false; - } - } - - FileView { - id: settingsFile - - path: StandardPaths.writableLocation(StandardPaths.GenericStateLocation) + "/DankMaterialShell/appusage.json" - blockLoading: true - blockWrites: true - watchChanges: true - onLoaded: { - if (root._saving) - return; - parseSettings(settingsFile.text()); - } - onLoadFailed: error => {} - } -} |