mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Migration: clear recently used emojis
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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 {}
|
||||
}
|
||||
|
||||
@@ -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 + "/"
|
||||
|
||||
Reference in New Issue
Block a user