Skip to content

Commit

Permalink
Add More Keys, Edit theme.
Browse files Browse the repository at this point in the history
  • Loading branch information
xM4ddy committed May 17, 2024
1 parent cd8d549 commit 476000f
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 138 deletions.
Binary file modified Assets/OFGB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 21 additions & 70 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,89 +4,40 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="#01FFFFFF"
Loaded="EnableBlur"
Background="#1E1E2E"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
AllowsTransparency="True"
Title="OFGB - Version 0.2"
Title="OFGB"
SizeToContent="WidthAndHeight">
<WindowChrome.WindowChrome>
<WindowChrome
CaptionHeight="30"
CaptionHeight="32"
CornerRadius="0"
GlassFrameThickness="0"
UseAeroCaptionButtons="False" />
</WindowChrome.WindowChrome>
<Grid>
<Image Source="/Assets/OFGB.png" SnapsToDevicePixels="True" Panel.ZIndex="1" Margin="12,6,0,0" Height="16" VerticalAlignment="Top" HorizontalAlignment="Left" />
<Button Content="&#xe8bb;" FontSize="10" Panel.ZIndex="1" Width="40" Click="Close" Height="30" WindowChrome.IsHitTestVisibleInChrome="True" />
<Image Source="/Assets/OFGB.png" SnapsToDevicePixels="True" Panel.ZIndex="1" Margin="8,8,0,0" Height="16" VerticalAlignment="Top" HorizontalAlignment="Left" />
<Button Content="&#xe8bb;" x:Name="close" FontSize="10" Panel.ZIndex="1" Width="40" Click="Close" Height="32" WindowChrome.IsHitTestVisibleInChrome="True" />

<CheckBox x:Name="cb1" Margin="12,30,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable File Explorer Ads" />
<CheckBox x:Name="cb2" Margin="12,50,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable Lock Screen Tips and Ads" />
<CheckBox x:Name="cb3" Margin="12,70,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable Settings Ads" />
<CheckBox x:Name="cb4" Margin="12,90,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable General Tips and Ads" />
<CheckBox x:Name="cb5" Margin="12,110,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable &quot;Finish Setup&quot; Ads" />
<CheckBox x:Name="cb6" Margin="12,130,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable &quot;Welcome Experience&quot; Ads" />
<CheckBox x:Name="cb7" Margin="12,150,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable Personalized Ads" />
<CheckBox x:Name="cb8" Margin="12,170,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable &quot;Tailored Experiences&quot;" />
<CheckBox x:Name="cb9" Margin="12,190,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable Start Menu Ads" />
<CheckBox x:Name="cb1" Margin="8,32,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable File Explorer Ads" />
<CheckBox x:Name="cb2" Margin="8,52,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable Lock Screen Tips and Ads" />
<CheckBox x:Name="cb3" Margin="8,72,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable Settings Ads" />
<CheckBox x:Name="cb4" Margin="8,92,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable General Tips and Ads" />
<CheckBox x:Name="cb5" Margin="8,112,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable &quot;Finish Setup&quot; Ads" />
<CheckBox x:Name="cb6" Margin="8,132,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable &quot;Welcome Experience&quot; Ads" />
<CheckBox x:Name="cb7" Margin="8,152,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable Personalized Ads" />
<CheckBox x:Name="cb8" Margin="8,172,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable &quot;Tailored Experiences&quot;" />
<CheckBox x:Name="cb9" Margin="8,192,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable Start Menu Ads" />
<CheckBox x:Name="cb10" Margin="8,212,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable &quot;Notification Suggestions&quot;" />

<TextBlock Foreground="Gray" FontSize="12" HorizontalAlignment="Right" VerticalAlignment="Bottom" TextAlignment="Left" Margin="0,0,8,5" TextWrapping="Wrap" Text="v0.3"/>
<TextBlock Foreground="#FFAAAA" Width="210" Margin="13,210,0,0" TextWrapping="Wrap" Text="*You may need to restart your PC for changes to apply!"/>
<Rectangle HorizontalAlignment="Stretch" Margin="8,234,8,0" Fill="Gray" Height="0.9" VerticalAlignment="Top" />
<TextBlock Foreground="#F5C2E7" Width="210" Margin="9,240,0,0" Text="These require running as admin."/>

<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Width="10" Margin="0,0,0,0" Height="250">
<Rectangle Width="10" Height="50">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0.0,0.0" EndPoint="1.0,0.0">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0.8" Color="#00000000"/>
<GradientStop Offset="0.0" Color="LightBlue"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="10" Height="50">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0.0,0.0" EndPoint="1.0,0.0">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0.8" Color="#00000000"/>
<GradientStop Offset="0.0" Color="Pink"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="10" Height="50">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0.0,0.0" EndPoint="1.0,0.0">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0.8" Color="#00000000"/>
<GradientStop Offset="0.0" Color="White"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="10" Height="50">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0.0,0.0" EndPoint="1.0,0.0">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0.8" Color="#00000000"/>
<GradientStop Offset="0.0" Color="Pink"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="10" Height="50">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0.0,0.0" EndPoint="1.0,0.0">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0.8" Color="#00000000"/>
<GradientStop Offset="0.0" Color="LightBlue"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
</StackPanel>
<CheckBox x:Name="cb11" Margin="8,262,0,0" Checked="Checked" Unchecked="Unchecked" Content="Disable Bing Results In Search" />
<CheckBox x:Name="cb12" Margin="8,282,0,0" Checked="Checked" Unchecked="Unchecked" Padding="4,-1,10,23" Content="Disable Edge Search Bar Widget" />

<TextBlock Foreground="Gray" FontSize="12" HorizontalAlignment="Right" VerticalAlignment="Bottom" TextAlignment="Left" Margin="0,0,8,5" TextWrapping="Wrap" Text="v0.4"/>
</Grid>
</Window>
104 changes: 51 additions & 53 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Windows.Interop;
using System.Runtime.InteropServices;
using System.Windows.Controls;
using System.Security.Principal;

namespace OFGB
{
Expand All @@ -13,24 +14,6 @@ namespace OFGB

public partial class MainWindow : Window
{
[StructLayout(LayoutKind.Sequential)]
internal struct AccentPolicy
{
public uint AccentState;
public uint AccentFlags;
public uint GradientColor;
public uint AnimationId;
}
[StructLayout(LayoutKind.Sequential)]
internal struct WindowCompositionAttributeData
{
public int Attribute;
public IntPtr Data;
public int SizeOfData;
}

[LibraryImport("user32.dll", EntryPoint = "SetWindowCompositionAttribute")]
internal static partial int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
[LibraryImport("dwmapi.dll", EntryPoint = "DwmSetWindowAttribute")]
internal static partial int DwmSetWindowAttribute(IntPtr hwnd, int attr, [In] int[] attrValue, int attrSize);

Expand All @@ -40,30 +23,8 @@ public MainWindow()
{
InitializeComponent();
InitializeKeys();
}

internal void EnableBlur(object? sender, EventArgs? e)
{
var accent = new AccentPolicy()
{
AccentFlags = 2,
AccentState = 4,
GradientColor = 0x00000055
};

var accentPtr = Marshal.AllocHGlobal(Marshal.SizeOf(accent));
Marshal.StructureToPtr(accent, accentPtr, false);

var data = new WindowCompositionAttributeData()
{
Attribute = 19,
SizeOfData = Marshal.SizeOf(accent),
Data = accentPtr,
};

SetWindowCompositionAttribute((new WindowInteropHelper(this)).Handle, ref data);
DwmSetWindowAttribute(new WindowInteropHelper(this).Handle, 33, [2], sizeof(int));
Marshal.FreeHGlobal(accentPtr);
DwmSetWindowAttribute(new WindowInteropHelper(Application.Current.MainWindow).EnsureHandle(), 33, [2], sizeof(int));
}

private void InitializeKeys()
Expand Down Expand Up @@ -106,6 +67,28 @@ private void InitializeKeys()
// "Show recommendations for tips, shortcuts, new apps, and more" on Start
bool key12 = CreateKey(cur_ver + "Explorer\\Advanced", "Start_IrisRecommendations");
cb9.IsChecked = key12;

// "Turn off notifications from <app>? We noticed you haven't opened these in a while."
bool key13 = CreateKey(cur_ver + "Notifications\\Settings\\Windows.ActionCenter.SmartOptOut", "Enabled");
cb10.IsChecked = key13;

// These Need To Be Run As Administrator
if (IsRunningAsAdministrator())
{
// Show Bing Results in Windows Search (Inverted, 1 == Disabled)
bool key14 = CreateKey("Software\\Policies\\Microsoft\\Windows\\Explorer", "DisableSearchBoxSuggestions");
bool key15 = CreateKey(cur_ver + "Search", "BingSearchEnabled");
cb11.IsChecked = key14 && key15;

// Disable Edge desktop search widget bar
bool key16 = CreateKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Microsoft\\Edge", "WebWidgetAllowed");
cb12.IsChecked = key16;
}
else
{
cb11.IsEnabled = false;
cb12.IsEnabled = false;
}
}

private static bool CreateKey(string loc, string key)
Expand Down Expand Up @@ -142,38 +125,53 @@ private static void ToggleOptions(string checkboxName, bool enable)
switch (checkboxName)
{
case "cb1":
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "Explorer\\Advanced\\", "ShowSyncProviderNotifications", value);
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "Explorer\\Advanced\\", "ShowSyncProviderNotifications", Convert.ToInt32(!enable));
break;
case "cb2":
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "ContentDeliveryManager", "RotatingLockScreenOverlayEnabled", value);
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "ContentDeliveryManager", "SubscribedContent-338387Enabled", value);
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "ContentDeliveryManager", "RotatingLockScreenOverlayEnabled", Convert.ToInt32(!enable));
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "ContentDeliveryManager", "SubscribedContent-338387Enabled", Convert.ToInt32(!enable));
break;
case "cb3":
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "ContentDeliveryManager", "SubscribedContent-338393Enabled", value);
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "ContentDeliveryManager", "SubscribedContent-353694Enabled", value);
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "ContentDeliveryManager", "SubscribedContent-353696Enabled", value);
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "ContentDeliveryManager", "SubscribedContent-338393Enabled", Convert.ToInt32(!enable));
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "ContentDeliveryManager", "SubscribedContent-353694Enabled", Convert.ToInt32(!enable));
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "ContentDeliveryManager", "SubscribedContent-353696Enabled", Convert.ToInt32(!enable));
break;
case "cb4":
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "ContentDeliveryManager", "SubscribedContent-338389Enabled", value);
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "ContentDeliveryManager", "SubscribedContent-338389Enabled", Convert.ToInt32(!enable));
break;
case "cb5":
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "UserProfileEngagement", "ScoobeSystemSettingEnabled", value);
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "UserProfileEngagement", "ScoobeSystemSettingEnabled", Convert.ToInt32(!enable));
break;
case "cb6":
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "ContentDeliveryManager", "SubscribedContent-310093Enabled", value);
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "ContentDeliveryManager", "SubscribedContent-310093Enabled", Convert.ToInt32(!enable));
break;
case "cb7":
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "AdvertisingInfo", "Enabled", value);
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "AdvertisingInfo", "Enabled", Convert.ToInt32(!enable));
break;
case "cb8":
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "Privacy", "TailoredExperiencesWithDiagnosticDataEnabled", value);
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "Privacy", "TailoredExperiencesWithDiagnosticDataEnabled", Convert.ToInt32(!enable));
break;
case "cb9":
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "Explorer\\Advanced", "Start_IrisRecommendations", value);
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "Explorer\\Advanced", "Start_IrisRecommendations", Convert.ToInt32(!enable));
break;
case "cb10":
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "Notifications\\Settings\\Windows.ActionCenter.SmartOptOut", "Enabled", Convert.ToInt32(!enable));
break;
case "cb11":
Registry.SetValue("HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\Windows\\Explorer", "DisableSearchBoxSuggestions", Convert.ToInt32(enable)); // Inverted
Registry.SetValue("HKEY_CURRENT_USER\\" + cur_ver + "Search", "BingSearchEnabled", Convert.ToInt32(!enable));
break;
case "cb12":
Registry.SetValue("HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\Edge", "WebWidgetAllowed", Convert.ToInt32(!enable));
break;
}
}

public static bool IsRunningAsAdministrator()
{
return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);
}

private void Checked(object sender, RoutedEventArgs e)
{
ToggleOptions(((CheckBox)sender).Name, true);
Expand Down
31 changes: 16 additions & 15 deletions dark.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#c32b1c" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="#F5C2E7" />
<Setter Property="Foreground" Value="#1E1E2E" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="DarkGray" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="#585B70" />
<Setter Property="Foreground" Value="#11111b" />
</Trigger>
</Style.Triggers>
</Style>
Expand Down Expand Up @@ -77,23 +77,24 @@
</Setter>
</Style>
<SolidColorBrush x:Key="OptionMark.Static.Background" Color="Transparent" />
<SolidColorBrush x:Key="OptionMark.Static.Border" Color="#8f8f8f" />
<SolidColorBrush x:Key="OptionMark.Static.Glyph" Color="White" />
<SolidColorBrush x:Key="OptionMark.Static.Border" Color="#585B70" />
<SolidColorBrush x:Key="OptionMark.Static.Glyph" Color="#F5C2E7" />
<SolidColorBrush x:Key="OptionMark.MouseOver.Background" Color="Transparent" />
<SolidColorBrush x:Key="OptionMark.MouseOver.Border" Color="#FF5593FF" />
<SolidColorBrush x:Key="OptionMark.MouseOver.Glyph" Color="White" />
<SolidColorBrush x:Key="OptionMark.MouseOver.Border" Color="#89B4FA" />
<SolidColorBrush x:Key="OptionMark.MouseOver.Glyph" Color="#f9c5eb" />
<SolidColorBrush x:Key="OptionMark.Pressed.Background" Color="Transparent" />
<SolidColorBrush x:Key="OptionMark.Pressed.Border" Color="#FF3C77DD" />
<SolidColorBrush x:Key="OptionMark.Pressed.Glyph" Color="#dedede" />
<SolidColorBrush x:Key="OptionMark.Disabled.Background" Color="#FFE6E6E6" />
<SolidColorBrush x:Key="OptionMark.Disabled.Border" Color="#FFBCBCBC" />
<SolidColorBrush x:Key="OptionMark.Disabled.Glyph" Color="#FF707070" />
<SolidColorBrush x:Key="OptionMark.Pressed.Border" Color="#89B4FA" />
<SolidColorBrush x:Key="OptionMark.Pressed.Glyph" Color="#b791ad" />
<SolidColorBrush x:Key="OptionMark.Disabled.Background" Color="#585B70" />
<SolidColorBrush x:Key="OptionMark.Disabled.Foreground" Color="black" />
<SolidColorBrush x:Key="OptionMark.Disabled.Border" Color="Transparent" />
<SolidColorBrush x:Key="OptionMark.Disabled.Glyph" Color="#FF64505E" />
<Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource checkBoxStyleCommon}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
<Setter Property="Background" Value="{StaticResource OptionMark.Static.Background}" />
<Setter Property="BorderBrush" Value="{StaticResource OptionMark.Static.Border}" />
<Setter Property="Foreground" Value="White" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="#CDD6F4" />
<Setter Property="BorderThickness" Value="1.3" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CheckBox}">
Expand Down

0 comments on commit 476000f

Please sign in to comment.