Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions SnapActions/Config/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ public class AppSettings
"KeePass", "KeePassXC", "1Password", "Bitwarden", "Dashlane", "Enpass", "LastPass",
"RoboForm", "NordPass", "ProtonPass", "KeeperPasswordManager"
];
/// <summary>
/// Tracks which "default ExcludedApps additions" generation this settings file has
/// already absorbed. SettingsManager.MigrateExcludedAppsDefaults merges new entries
/// forward on Load — users upgrading from an earlier version pick up newly-added
/// exclusions automatically without overwriting their own customizations. Removing
/// an entry sticks because we only ever *add*, and we only add once per generation.
/// </summary>
public int ExcludedAppsDefaultsVersion { get; set; } = 0;

public bool ReplaceSelectionOnTransform { get; set; } = true;

/// <summary>
Expand Down
32 changes: 32 additions & 0 deletions SnapActions/Config/SettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,42 @@ public static void Load()
// Migrate: update built-in search engines to latest defaults
MigrateSearchEngines();
MigrateActionIds();
MigrateExcludedAppsDefaults();
PruneStaleActionIds();
PruneStaleBackups();
}

/// <summary>
/// Newly-added default ExcludedApps entries, grouped by the version that introduced them.
/// Each existing settings.json moves forward through this list once — users keep their
/// own additions, and any entry they explicitly remove stays removed because we record
/// the highest applied version in ExcludedAppsDefaultsVersion. New entries should
/// always be appended with the next sequential version.
/// </summary>
private static readonly (int Version, string[] Apps)[] ExcludedAppsDefaultsHistory =
{
// v1.6.15: PotPlayer reacts to a synthetic Ctrl+Insert (the capture-cascade's last
// resort) as a non-copy shortcut, and its custom-chrome title bar reports as client
// area to NCHITTEST so a drag-as-title-bar isn't suppressed earlier. Excluding it
// entirely is the surgical fix for the user-reported interference; users who do want
// capture in PotPlayer can remove these from Settings → Excluded apps.
(Version: 1, Apps: new[] { "PotPlayerMini64", "PotPlayerMini" }),
};

private static void MigrateExcludedAppsDefaults()
{
foreach (var (version, apps) in ExcludedAppsDefaultsHistory)
{
if (Current.ExcludedAppsDefaultsVersion >= version) continue;
foreach (var app in apps)
{
if (!Current.ExcludedApps.Any(e => e.Equals(app, StringComparison.OrdinalIgnoreCase)))
Current.ExcludedApps.Add(app);
}
Current.ExcludedAppsDefaultsVersion = version;
}
}

/// <summary>
/// Keep only the 5 most recent settings.json.broken-* backups. Without this, repeated load
/// failures (dying disk, AV scanner racing) accumulate junk in %AppData%\SnapActions forever.
Expand Down
2 changes: 1 addition & 1 deletion SnapActions/SnapActions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
<AssemblyName>SnapActions</AssemblyName>
<RootNamespace>SnapActions</RootNamespace>
<Version>1.6.14</Version>
<Version>1.6.15</Version>
<!-- We're WPF-primary (WinForms is only NotifyIcon). The manifest's PerMonitorV2 declaration
is what the OS reads at process startup. WinForms' WFO0003 wants its own DPI hook. -->
<NoWarn>$(NoWarn);WFO0003</NoWarn>
Expand Down
Loading