diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md
index 25a4fa8..304fc47 100644
--- a/CHANGELOG.en-US.md
+++ b/CHANGELOG.en-US.md
@@ -3,6 +3,8 @@
English (US) release notes, mirroring CHANGELOG.md (Brazilian Portuguese). Before publishing a version, add a `## [VERSION]` section to **both** files: the workflow publishes the section matching the tag from each one and fails if either is missing.
## [Unreleased]
+### Fixes
+- Settings: `config.json` keeps the settings this version doesn't know instead of dropping them on save. It is what lets you switch between the current version and **Legacy** (the old interface, published next to 1.7.0) without losing anything on either side. (#201)
## [1.7.0-beta.4]
### What's new
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2660de3..cd322a0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,8 @@
Notas em português do Brasil; a versão em inglês (Estados Unidos) fica em `CHANGELOG.en-US.md`. Antes de publicar uma versão, adicione uma seção `## [VERSÃO]` com o changelog daquela versão **nos dois arquivos**. O workflow publica as duas seções correspondentes à tag na mesma release e falha se faltar alguma.
## [Unreleased]
+### Correções
+- Ajustes: o `config.json` guarda de volta os ajustes que esta versão não conhece em vez de descartá-los ao salvar. É o que deixa trocar entre a versão atual e a **Legacy** (a interface antiga, publicada junto da 1.7.0) sem perder nada dos dois lados. (#201)
## [1.7.0-beta.4]
### Novidades
diff --git a/src/ConsoleMode/Models/Models.cs b/src/ConsoleMode/Models/Models.cs
index 9c74c26..e2facbd 100644
--- a/src/ConsoleMode/Models/Models.cs
+++ b/src/ConsoleMode/Models/Models.cs
@@ -1,3 +1,4 @@
+using System.Text.Json;
using System.Text.Json.Serialization;
using ConsoleMode.Services;
@@ -7,6 +8,11 @@ public sealed class AppConfig
{
/// 2 = monitor fields hold ; 0/1 = GDI names (\\.\DISPLAYn).
public int Version { get; set; }
+ ///
+ /// Settings this version doesn't have: the Legacy build's (which interface it shows, its tour) or a newer
+ /// version's. Kept as they came and saved back, so switching between builds loses nothing on either side.
+ ///
+ [JsonExtensionData] public Dictionary? OtherSettings { get; set; }
/// Empty until the user (or the installer) picks one; the app then follows Windows.
public string AppLanguage { get; set; } = "";
public string FocusMonitor { get; set; } = "";
diff --git a/src/ConsoleMode/ViewModels/MainViewModel.cs b/src/ConsoleMode/ViewModels/MainViewModel.cs
index 069accb..c2557cc 100644
--- a/src/ConsoleMode/ViewModels/MainViewModel.cs
+++ b/src/ConsoleMode/ViewModels/MainViewModel.cs
@@ -875,6 +875,7 @@ private AppConfig BuildConfig()
var auto = audioId == ConsoleEngine.AudioOnConnectId;
var config = new AppConfig
{
+ OtherSettings = _loadedConfig.OtherSettings,
AppLanguage = SelectedLanguage?.Value ?? LocalizationService.Language,
// Listing failed: keep the saved screens instead of wiping them.
FocusMonitor = _loadedConfig.FocusMonitor,
diff --git a/tests/ConsoleMode.Tests/AppConfigTests.cs b/tests/ConsoleMode.Tests/AppConfigTests.cs
index 2509402..aadc6a5 100644
--- a/tests/ConsoleMode.Tests/AppConfigTests.cs
+++ b/tests/ConsoleMode.Tests/AppConfigTests.cs
@@ -6,6 +6,29 @@ namespace ConsoleMode.Tests;
public class AppConfigTests
{
+ // The Legacy build (1.6.2's interfaces) shares config.json and has settings this version dropped.
+ [Fact]
+ public void Settings_of_another_build_survive_a_save()
+ {
+ var options = new System.Text.Json.JsonSerializerOptions
+ {
+ PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase,
+ DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull
+ };
+ var config = System.Text.Json.JsonSerializer.Deserialize(
+ """{ "version": 2, "uiMode": "desktop", "tourDone": true, "parkPointer": false }""", options)!;
+ Assert.False(config.ParkPointer);
+
+ config.HdrEnable = true;
+ using var saved = System.Text.Json.JsonDocument.Parse(System.Text.Json.JsonSerializer.Serialize(config, options));
+ Assert.Equal("desktop", saved.RootElement.GetProperty("uiMode").GetString());
+ Assert.True(saved.RootElement.GetProperty("tourDone").GetBoolean());
+ Assert.True(saved.RootElement.GetProperty("hdrEnable").GetBoolean());
+ // Nothing extra in a config of its own.
+ Assert.Null(new AppConfig().OtherSettings);
+ Assert.DoesNotContain("otherSettings", System.Text.Json.JsonSerializer.Serialize(new AppConfig(), options));
+ }
+
[Fact]
public void Copy_for_a_session_swaps_only_the_monitor_fields()
{