diff --git a/Assets/settings-default.json b/Assets/settings-default.json index 789023e3e..4ff8daef4 100644 --- a/Assets/settings-default.json +++ b/Assets/settings-default.json @@ -121,7 +121,8 @@ "Right" ], "keyEnter": [ - "Return" + "Return", + "Enter" ], "keyEscape": [ "Esc" diff --git a/Commons/Migrations/Migration54.qml b/Commons/Migrations/Migration54.qml new file mode 100644 index 000000000..367ab122b --- /dev/null +++ b/Commons/Migrations/Migration54.qml @@ -0,0 +1,28 @@ +import QtQuick + +QtObject { + id: root + + // Add numpad Enter as a second default keybind for keyEnter + function migrate(adapter, logger, rawJson) { + logger.i("Settings", "Migrating settings to v54"); + + const keybinds = rawJson?.general?.keybinds; + if (!keybinds) + return true; + + const keyEnter = keybinds.keyEnter; + if (!keyEnter || !Array.isArray(keyEnter)) + return true; + + // Only add "Enter" if the first entry is "Return" and "Enter" isn't already present + if (keyEnter[0] === "Return" && !keyEnter.includes("Enter")) { + var updated = Array.from(keyEnter); + updated.splice(1, 0, "Enter"); + adapter.general.keybinds.keyEnter = updated; + logger.i("Settings", "Added 'Enter' (numpad) as second default keybind for keyEnter"); + } + + return true; + } +} diff --git a/Commons/Migrations/MigrationRegistry.qml b/Commons/Migrations/MigrationRegistry.qml index 459760148..0ff2a5681 100644 --- a/Commons/Migrations/MigrationRegistry.qml +++ b/Commons/Migrations/MigrationRegistry.qml @@ -25,7 +25,8 @@ QtObject { 48: migration48Component, 49: migration49Component, 50: migration50Component, - 53: migration53Component + 53: migration53Component, + 54: migration54Component }) // Migration components @@ -48,4 +49,5 @@ QtObject { property Component migration49Component: Migration49 {} property Component migration50Component: Migration50 {} property Component migration53Component: Migration53 {} + property Component migration54Component: Migration54 {} } diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 84583d43e..241331789 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -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: 53 + readonly property int settingsVersion: 54 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 + "/" @@ -304,7 +304,7 @@ Singleton { property list keyDown: ["Down"] property list keyLeft: ["Left"] property list keyRight: ["Right"] - property list keyEnter: ["Return"] + property list keyEnter: ["Return", "Enter"] property list keyEscape: ["Esc"] property list keyRemove: ["Del"] }