Files
Crapfixer/MSCFixer/Features/UI/Transparency.cs
T
2025-05-07 19:39:40 +02:00

68 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Microsoft.Win32;
using System;
using Crapfixer;
using System.Threading.Tasks;
namespace Settings.Personalization
{
internal class Transparency : FeatureBase
{
private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize";
private const string valueName = "EnableTransparency";
private const int recommendedValue = 0;
public override string GetFeatureDetails()
{
return $"{keyName} | Value: {valueName} | Suggestion: {recommendedValue} (No transparency smoother performance, still stylish)";
}
public override string ID()
{
return "Disable Transparency Effects";
}
public override string Info()
{
return "This feature disables transparency effects for Start menu, taskbar, and other surfaces.";
}
public override Task<bool> CheckFeature()
{
return Task.FromResult(
Utils.IntEquals(keyName, valueName, recommendedValue)
);
}
public override Task<bool> DoFeature()
{
try
{
Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
return Task.FromResult(true);
}
catch (Exception ex)
{
Logger.Log("Error in DisableTransparency: " + ex.Message, LogLevel.Error);
}
return Task.FromResult(false);
}
public override bool UndoFeature()
{
try
{
Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
return true;
}
catch (Exception ex)
{
Logger.Log("Error in DisableTransparency (Undo): " + ex.Message, LogLevel.Error);
}
return false;
}
}
}