feature: supports to disable Mica effect on Windows 11 from theme overrides (#2191)

Add `UseMicaOnWindows11` to custom theme schema

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2026-03-16 11:52:48 +08:00
parent 203dad3036
commit 14db2d5cb0
4 changed files with 11 additions and 1 deletions

View File

@@ -286,6 +286,8 @@ namespace SourceGit
else
Models.CommitGraph.SetDefaultPens(overrides.GraphPenThickness);
Native.OS.UseMicaOnWindows11 = overrides.UseMicaOnWindows11;
app.Resources.MergedDictionaries.Add(resDic);
app._themeOverrides = resDic;
}

View File

@@ -9,6 +9,7 @@ namespace SourceGit.Models
public Dictionary<string, Color> BasicColors { get; set; } = new Dictionary<string, Color>();
public double GraphPenThickness { get; set; } = 2;
public double OpacityForNotMergedCommits { get; set; } = 0.5;
public bool UseMicaOnWindows11 { get; set; } = true;
public List<Color> GraphColors { get; set; } = new List<Color>();
}
}

View File

@@ -107,6 +107,12 @@ namespace SourceGit.Native
set;
} = string.Empty;
public static bool UseMicaOnWindows11
{
get => OperatingSystem.IsWindows() && OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000) && _enableMicaOnWindows11;
set => _enableMicaOnWindows11 = value;
}
public static bool UseSystemWindowFrame
{
get => OperatingSystem.IsLinux() && _enableSystemWindowFrame;
@@ -294,5 +300,6 @@ namespace SourceGit.Native
private static IBackend _backend = null;
private static string _gitExecutable = string.Empty;
private static bool _enableSystemWindowFrame = false;
private static bool _enableMicaOnWindows11 = true;
}
}

View File

@@ -62,7 +62,7 @@ namespace SourceGit.Views
InitializeComponent();
PositionChanged += OnPositionChanged;
if (OperatingSystem.IsWindows() && OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000))
if (Native.OS.UseMicaOnWindows11)
{
Background = Brushes.Transparent;
TransparencyLevelHint = [WindowTransparencyLevel.Mica];