Migration: clear recently used emojis

This commit is contained in:
Ly-sec
2025-12-31 18:17:47 +01:00
parent 18b145871e
commit 30733f6502
3 changed files with 33 additions and 2 deletions
+29
View File
@@ -0,0 +1,29 @@
import QtQuick
import Quickshell
import qs.Commons
QtObject {
id: root
// Clear legacy emoji usage cache to adopt new format
function migrate(adapter, logger, rawJson) {
logger.i("Settings", "Migrating settings to v36");
const usagePath = Settings.cacheDir + "emoji_usage.json";
if (!usagePath.endsWith("emoji_usage.json")) {
logger.w("Settings", "Skipping emoji usage cleanup due to unexpected path: " + usagePath);
return true;
}
try {
// Ensure dir exists then remove the file
Quickshell.execDetached(["sh", "-c", `mkdir -p "${Settings.cacheDir}" && rm -f -- "${usagePath}"`]);
logger.i("Settings", "Cleared legacy emoji usage file at: " + usagePath);
} catch (e) {
logger.w("Settings", "Failed to clear emoji usage cache: " + e);
}
return true;
}
}
+3 -1
View File
@@ -11,7 +11,8 @@ QtObject {
28: migration28Component,
32: migration32Component,
33: migration33Component,
35: migration35Component
35: migration35Component,
36: migration36Component
})
// Migration components
@@ -20,4 +21,5 @@ QtObject {
property Component migration32Component: Migration32 {}
property Component migration33Component: Migration33 {}
property Component migration35Component: Migration35 {}
property Component migration36Component: Migration36 {}
}
+1 -1
View File
@@ -25,7 +25,7 @@ Singleton {
- Default cache directory: ~/.cache/noctalia
*/
readonly property alias data: adapter // Used to access via Settings.data.xxx.yyy
readonly property int settingsVersion: 35
readonly property int settingsVersion: 36
readonly property bool isDebug: Quickshell.env("NOCTALIA_DEBUG") === "1"
readonly property string shellName: "noctalia"
readonly property string configDir: Quickshell.env("NOCTALIA_CONFIG_DIR") || (Quickshell.env("XDG_CONFIG_HOME") || Quickshell.env("HOME") + "/.config") + "/" + shellName + "/"