Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.IO;
using AtlasToolbox.Stores;
using AtlasToolbox.Utils;
using Microsoft.Extensions.DependencyInjection;
Expand All @@ -13,6 +14,12 @@ public class LockScreenConfigurationService : IConfigurationService
private const string PERSONALIZATION_KEY_NAME = @"HKLM\SOFTWARE\Policies\Microsoft\Windows\Personalization";

private const string NO_LOCK_SCREEN_VALUE_NAME = "NoLockScreen";
private const string NO_CHANGING_LOCK_SCREEN_VALUE_NAME = "NoChangingLockScreen";

private static readonly string LockScreenScriptDir = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.Windows),
@"AtlasDesktop\4. Interface Tweaks\Lock Screen"
);
Comment on lines +19 to +22

private readonly ConfigurationStore _lockScreenConfigurationStore;

Expand All @@ -25,17 +32,19 @@ public LockScreenConfigurationService(
public void Disable()
{
RegistryHelper.SetValue(PERSONALIZATION_KEY_NAME, NO_LOCK_SCREEN_VALUE_NAME, 1, Microsoft.Win32.RegistryValueKind.DWord);
RegistryHelper.SetValue(PERSONALIZATION_KEY_NAME, NO_CHANGING_LOCK_SCREEN_VALUE_NAME, 1, Microsoft.Win32.RegistryValueKind.DWord);
RegistryHelper.SetValue(ATLAS_STORE_KEY_NAME, STATE_VALUE_NAME, 0);
RegistryHelper.SetValue(ATLAS_STORE_KEY_NAME, "path", @$"{Environment.GetEnvironmentVariable("windir")}\AtlasDesktop\4. Interface Tweaks\Lock Screen\Hide Lock Screen.cmd");
RegistryHelper.SetValue(ATLAS_STORE_KEY_NAME, "path", Path.Combine(LockScreenScriptDir, "Hide Lock Screen.ps1"));

_lockScreenConfigurationStore.CurrentSetting = IsEnabled();
}

public void Enable()
{
RegistryHelper.DeleteValue(PERSONALIZATION_KEY_NAME, NO_LOCK_SCREEN_VALUE_NAME);
RegistryHelper.DeleteValue(PERSONALIZATION_KEY_NAME, NO_CHANGING_LOCK_SCREEN_VALUE_NAME);
RegistryHelper.SetValue(ATLAS_STORE_KEY_NAME, STATE_VALUE_NAME, 1);
RegistryHelper.SetValue(ATLAS_STORE_KEY_NAME, "path", @$"{Environment.GetEnvironmentVariable("windir")}\AtlasDesktop\4. Interface Tweaks\Lock Screen\Show Lock Screen (default).cmd");
RegistryHelper.SetValue(ATLAS_STORE_KEY_NAME, "path", Path.Combine(LockScreenScriptDir, "Show Lock Screen (default).ps1"));

_lockScreenConfigurationStore.CurrentSetting = IsEnabled();
}
Expand Down