Settings: migration for shellstate is now handled in Settings.qml

This commit is contained in:
Ly-sec
2025-11-22 15:40:53 +01:00
parent 83d1cbacc7
commit 8eaa5cc034
7 changed files with 221 additions and 137 deletions
@@ -114,10 +114,7 @@ Popup {
// Check if cache is expired or missing
if (!cachedTimestamp || (now >= cachedTimestamp + schemesCacheUpdateFrequency)) {
// Try migration first if cache is empty
if (cachedSchemes.length === 0) {
migrateFromOldSchemesList();
}
// Migration is now handled in Settings.qml
// Only fetch from API if we haven't fetched recently (prevent rapid repeated calls)
const timeSinceLastFetch = now - lastApiFetchTime;
@@ -160,32 +157,6 @@ Popup {
}
}
function migrateFromOldSchemesList() {
const oldSchemesPath = Settings.cacheDir + "color-schemes-list.json";
const migrationFileView = Qt.createQmlObject(`
import QtQuick
import Quickshell.Io
FileView {
id: migrationView
path: "${oldSchemesPath}"
printErrors: false
adapter: JsonAdapter {
property var schemes: []
property real timestamp: 0
}
onLoaded: {
root.availableSchemes = adapter.schemes || [];
root.saveSchemesToCache();
Logger.i("ColorSchemeDownload", "Migrated color-schemes-list.json to ShellState");
migrationView.destroy();
}
onLoadFailed: {
migrationView.destroy();
}
}
`, root, "schemesMigrationView");
}
function saveSchemesToCache() {
try {
ShellState.setColorSchemesList({