categories/UserExperience.ps1
|
# User Experience category: menu show delay, taskbar animations, transparency. All HKCU # (per-user), same precedent as explorer-start in feature 001 - no elevation required. # research.md -> user-experience category table. function Get-OctaUserExperienceCategory { [CmdletBinding()] param() return [pscustomobject]@{ Id = 'user-experience' DisplayName = 'User Experience' Description = 'Menu delay, taskbar animations, transparency' RequiresElevation = $false ContainsIrreversibleActions = $false GetActionsFunction = 'Get-OctaUserExperienceActions' ApplyActionFunction = 'Set-OctaUserExperienceAction' } } function Get-OctaUserExperienceActions { [CmdletBinding()] param() $actions = @() $desktopKey = 'HKCU:\Control Panel\Desktop' $currentDelay = (Get-ItemProperty -Path $desktopKey -Name 'MenuShowDelay' -ErrorAction SilentlyContinue).MenuShowDelay if ($null -eq $currentDelay -or $currentDelay -ne '0') { $displayCurrent = if ($null -eq $currentDelay) { '(not set)' } else { $currentDelay } $actions += New-OctaAction -TargetType Registry -TargetIdentifier "$desktopKey|MenuShowDelay" ` -CurrentValue $displayCurrent -PlannedValue '0' -Reversible $true -RiskLevel Safe } $advancedKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' $currentAnimations = (Get-ItemProperty -Path $advancedKey -Name 'TaskbarAnimations' -ErrorAction SilentlyContinue).TaskbarAnimations if ($null -eq $currentAnimations -or $currentAnimations -ne 0) { $displayCurrent = if ($null -eq $currentAnimations) { '(not set)' } else { $currentAnimations } $actions += New-OctaAction -TargetType Registry -TargetIdentifier "$advancedKey|TaskbarAnimations" ` -CurrentValue $displayCurrent -PlannedValue 0 -Reversible $true -RiskLevel Safe } $personalizeKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize' $currentTransparency = (Get-ItemProperty -Path $personalizeKey -Name 'EnableTransparency' -ErrorAction SilentlyContinue).EnableTransparency if ($null -eq $currentTransparency -or $currentTransparency -ne 0) { $displayCurrent = if ($null -eq $currentTransparency) { '(not set)' } else { $currentTransparency } $actions += New-OctaAction -TargetType Registry -TargetIdentifier "$personalizeKey|EnableTransparency" ` -CurrentValue $displayCurrent -PlannedValue 0 -Reversible $true -RiskLevel Safe } return $actions } function Set-OctaUserExperienceAction { [CmdletBinding()] param([Parameter(Mandatory)]$Action) $keyPath, $valueName = $Action.TargetIdentifier -split '\|', 2 if (-not (Test-Path $keyPath)) { New-Item -Path $keyPath -Force | Out-Null } $type = if ($valueName -eq 'MenuShowDelay') { 'String' } else { 'DWord' } Set-ItemProperty -Path $keyPath -Name $valueName -Value $Action.PlannedValue -Type $type } |