mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-21 21:30:37 +08:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user