From 987995a376155fe245a3e64c5cc27da33f449575 Mon Sep 17 00:00:00 2001 From: Stephan Yelle Date: Mon, 22 Dec 2025 10:31:01 -0500 Subject: [PATCH] Update samy.functions.ps1 --- samy.functions.ps1 | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/samy.functions.ps1 b/samy.functions.ps1 index 3d52fd7..a2a6e40 100644 --- a/samy.functions.ps1 +++ b/samy.functions.ps1 @@ -191,4 +191,48 @@ function Initialize-NuGetProvider { } } + function Invoke-EnableNumLock { + param($Context) + + try { + # .DEFAULT affects the logon screen + default profile behavior + $path = "Registry::HKEY_USERS\.DEFAULT\Control Panel\Keyboard" + New-Item -Path $path -Force | Out-Null + + # Common value: "2" = NumLock on at startup (Windows uses string here) + Set-ItemProperty -Path $path -Name "InitialKeyboardIndicators" -Value "2" -Type String + + Write-LogHybrid "NumLock default enabled (HKEY_USERS\.DEFAULT)" Success Tweaks -LogToEvent + Send-Text $Context "NumLock default enabled." + } + catch { + Write-LogHybrid "Enable NumLock failed: $($_.Exception.Message)" Error Tweaks -LogToEvent + Send-Text $Context "ERROR: $($_.Exception.Message)" + } + } + + function Invoke-ClassicContextMenu { + param($Context) + + try { + $key = "HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" + New-Item -Path $key -Force | Out-Null + + # Default value must be blank + Set-ItemProperty -Path $key -Name "(default)" -Value "" -Force + + # Restart Explorer so it takes effect + Stop-Process -Name explorer -Force -ErrorAction SilentlyContinue + Start-Process explorer.exe + + Write-LogHybrid "Classic context menu enabled (Win11)" Success Tweaks -LogToEvent + Send-Text $Context "Classic context menu enabled (Explorer restarted)." + } + catch { + Write-LogHybrid "Classic context menu tweak failed: $($_.Exception.Message)" Error Tweaks -LogToEvent + Send-Text $Context "ERROR: $($_.Exception.Message)" + } + } + + #endregion App handlers