work with some things

This commit is contained in:
2025-10-23 08:58:08 +02:00
parent c03146f094
commit 0cbd073d9e
7 changed files with 136 additions and 7 deletions

View File

@@ -23,7 +23,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>

View File

@@ -5,12 +5,12 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Perfect11.Inbox.Spotlight")]
[assembly: AssemblyTitle("Perfect11 Inbox Tweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Perfect11.Inbox.Spotlight")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyCompany("Vichingo455")]
[assembly: AssemblyProduct("Perfect11")]
[assembly: AssemblyCopyright("Copyright © 2025 Vichingo455")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

@@ -1,9 +1,10 @@
using Perfect11.TweaksInterface;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;
using Perfect11.TweaksInterface;
namespace Perfect11.Inbox.Spotlight
{
@@ -14,7 +15,94 @@ namespace Perfect11.Inbox.Spotlight
public string Category => "Annoyances";
public string Execute()
{
bool IsNotWindowsSpotlight()
{
const string keyPath = @"SOFTWARE\Policies\Microsoft\Windows\CloudContent";
const string valueName = "DisableWindowsSpotlightFeatures";
try
{
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyPath))
{
if (key == null)
return false;
object value = key.GetValue(valueName);
if (value == null)
return false;
if (value is int intValue)
return intValue == 1;
string stringValue = value.ToString();
if (int.TryParse(stringValue, out int parsed))
return parsed == 1;
return false;
}
}
catch (Exception)
{
return false;
}
}
if (!IsNotWindowsSpotlight())
{
using (var key = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Policies\Microsoft\Windows\CloudContent"))
{
key?.SetValue("DisableCloudOptimizedContent", 1, RegistryValueKind.DWord);
}
using (var key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Policies\Microsoft\Windows\CloudContent"))
{
key?.SetValue("DisableWindowsSpotlightFeatures", 1, RegistryValueKind.DWord);
key?.SetValue("DisableWindowsSpotlightWindowsWelcomeExperience", 1, RegistryValueKind.DWord);
key?.SetValue("DisableWindowsSpotlightOnActionCenter", 1, RegistryValueKind.DWord);
key?.SetValue("DisableWindowsSpotlightOnSettings", 1, RegistryValueKind.DWord);
key?.SetValue("DisableThirdPartySuggestions", 1, RegistryValueKind.DWord);
}
using (var key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"))
{
key?.SetValue("ContentDeliveryAllowed", 0, RegistryValueKind.DWord);
key?.SetValue("FeatureManagementEnabled", 0, RegistryValueKind.DWord);
key?.SetValue("SubscribedContentEnabled", 0, RegistryValueKind.DWord);
key?.SetValue("SubscribedContent-338387Enabled", 0, RegistryValueKind.DWord);
key?.SetValue("RotatingLockScreenOverlayEnabled", 0, RegistryValueKind.DWord);
}
using (var key = Registry.CurrentUser.CreateSubKey(
@"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"))
{
key?.SetValue("{2cc5ca98-6485-489a-920e-b3e88a6ccce3}", 1, RegistryValueKind.DWord);
}
return "Spotlight was disabled successfully.";
}
else
{
using (var key = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Policies\Microsoft\Windows\CloudContent"))
{
key.DeleteValue("DisableCloudOptimizedContent", false);
}
using (var key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Policies\Microsoft\Windows\CloudContent"))
{
key.DeleteValue("DisableWindowsSpotlightFeatures", false);
key.DeleteValue("DisableWindowsSpotlightWindowsWelcomeExperience", false);
key.DeleteValue("DisableWindowsSpotlightOnActionCenter", false);
key.DeleteValue("DisableWindowsSpotlightOnSettings", false);
key.DeleteValue("DisableThirdPartySuggestions", false);
}
using (var key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"))
{
key.DeleteValue("ContentDeliveryAllowed", false);
key.DeleteValue("FeatureManagementEnabled", false);
key.DeleteValue("SubscribedContentEnabled", false);
key.DeleteValue("SubscribedContent-338387Enabled", false);
key.DeleteValue("RotatingLockScreenOverlayEnabled", false);
}
using (var key = Registry.CurrentUser.CreateSubKey(
@"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"))
{
key.DeleteValue("{2cc5ca98-6485-489a-920e-b3e88a6ccce3}", false);
}
return "Spotlight was enabled successfully.";
}
}
}
}