Update samy.functions.ps1

This commit is contained in:
2025-12-22 10:31:01 -05:00
parent ab4d1124dc
commit 987995a376

View File

@@ -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