Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TransparencyEffects #50

Merged
merged 23 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b3e0074
TransparencyEffects
stephengillie Aug 9, 2024
10e8524
Add tests
stephengillie Aug 15, 2024
ba3aec5
Update resources/Microsoft.Windows.Setting.Accessibility/Microsoft.Wi…
stephengillie Aug 15, 2024
57b2a54
Update resources/Microsoft.Windows.Setting.Accessibility/Microsoft.Wi…
stephengillie Aug 15, 2024
c3e203e
Syntax updates.
stephengillie Aug 15, 2024
426ba46
Merge branch 'microsoft:main' into TransparencyEffects
stephengillie Aug 20, 2024
178dd01
Add tests.
stephengillie Aug 20, 2024
7cf8508
Remove previous tests.
stephengillie Aug 20, 2024
439e823
Merge branch 'main' into TransparencyEffects
stephengillie Aug 29, 2024
c0bfbb7
Revert incidental changes.
stephengillie Sep 4, 2024
ee60bb1
Integrating upstream changes.
stephengillie Sep 4, 2024
ea4bda2
Update variable name.
stephengillie Sep 4, 2024
e40fd12
Update another variable name.
stephengillie Sep 4, 2024
cb3812d
Clearspace cleanup.
stephengillie Sep 4, 2024
269a102
Import upstream changes.
stephengillie Sep 10, 2024
eecd41d
Merge branch 'main' into TransparencyEffects
stephengillie Sep 10, 2024
be82702
Remove duplicated Audio resource.
stephengillie Sep 10, 2024
8479a84
Swap a set of tabs for spaces.
stephengillie Sep 10, 2024
cfebd69
Swap VirtualEffect bool type for nullable bool.
stephengillie Sep 17, 2024
aafb001
Swap tabs for spaces and remove an unncessary line.
stephengillie Sep 17, 2024
4dc12cb
Merge branch 'main' into TransparencyEffects
ryfu-msft Sep 18, 2024
b02718b
Rename variables & section, and add null checks.
stephengillie Sep 18, 2024
fd2284c
Revert indentation modification.
stephengillie Sep 18, 2024
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
Expand Up @@ -34,9 +34,10 @@ if ([string]::IsNullOrEmpty($env:TestRegistryPath)) {
$global:PointerRegistryPath = 'HKCU:\Control Panel\Cursors\'
$global:ControlPanelAccessibilityRegistryPath= 'HKCU:\Control Panel\Accessibility\'
$global:AudioRegistryPath = 'HKCU:\Software\Microsoft\Multimedia\Audio\'
$global:PersonalizationRegistryPath = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize\'
}
else {
$global:AccessibilityRegistryPath = $global:MagnifierRegistryPath = $global:PointerRegistryPath = $global:ControlPanelAccessibilityRegistryPath = $global:AudioRegistryPath = $env:TestRegistryPath
$global:AccessibilityRegistryPath = $global:MagnifierRegistryPath = $global:PointerRegistryPath = $global:ControlPanelAccessibilityRegistryPath = $global:AudioRegistryPath = $global:PersonalizationRegistryPath = $env:TestRegistryPath
}


Expand Down Expand Up @@ -249,9 +250,11 @@ class VisualEffect
{
# Key required. Do not set.
[DscProperty(Key)] [string] $SID
[DscProperty()] [bool] $AlwaysShowScrollbars = $false
[DscProperty()] [nullable[bool]] $AlwaysShowScrollbars
[DscProperty()] [nullable[bool]] $TransparencyEffectsSetting

static hidden [string] $DynamicScrollbarsProperty = 'DynamicScrollbars'
static hidden [string] $TransparencySettingProperty = 'EnableTransparency'

static [bool] GetShowDynamicScrollbarsStatus()
{
Expand All @@ -266,10 +269,24 @@ class VisualEffect
}
}

static [bool] GetTransparencyStatus()
{
if (-not(DoesRegistryKeyPropertyExist -Path $global:PersonalizationRegistryPath -Name ([VisualEffect]::TransparencySettingProperty)))
{
return $false
}
else
{
$TransparencySetting = (Get-ItemProperty -Path $global:PersonalizationRegistryPath -Name ([VisualEffect]::TransparencySettingProperty)).EnableTransparency
return ($TransparencySetting -eq 0)
}
}

[VisualEffect] Get()
{
$currentState = [VisualEffect]::new()
$currentState.AlwaysShowScrollbars = [VisualEffect]::GetShowDynamicScrollbarsStatus()
$currentState.TransparencyEffectsSetting = [VisualEffect]::GetTransparencyStatus()
stephengillie marked this conversation as resolved.
Show resolved Hide resolved

return $currentState
}
Expand All @@ -281,6 +298,10 @@ class VisualEffect
{
return $false
}
if ($this.TransparencyEffectsSetting -ne $currentState.TransparencyEffectsSetting)
{
return $false
}
stephengillie marked this conversation as resolved.
Show resolved Hide resolved

return $true
}
Expand All @@ -293,10 +314,20 @@ class VisualEffect
{
New-Item -Path $global:ControlPanelAccessibilityRegistryPath -Force | Out-Null
}

$dynamicScrollbarValue = if ($this.AlwaysShowScrollbars) { 0 } else { 1 }

Set-ItemProperty -Path $global:ControlPanelAccessibilityRegistryPath -Name ([VisualEffect]::DynamicScrollbarsProperty) -Value $dynamicScrollbarValue
if ($null -ne $this.AlwaysShowScrollbars)
{
$dynamicScrollbarValue = if ($this.AlwaysShowScrollbars) { 0 } else { 1 }
Set-ItemProperty -Path $global:ControlPanelAccessibilityRegistryPath -Name ([VisualEffect]::DynamicScrollbarsProperty) -Value $dynamicScrollbarValue
}
if ($null -ne $this.TransparencyEffectsSetting)
{
$transparencyValue = if ($this.TransparencyEffectsSetting) { 0 } else { 1 }

if (-not (DoesRegistryKeyPropertyExist -Path $global:PersonalizationRegistryPath -Name ([VisualEffect]::TransparencySettingProperty))) {
New-ItemProperty -Path $global:PersonalizationRegistryPath -Name ([VisualEffect]::TransparencySettingProperty) -Value $transparencyValue -PropertyType DWord
}
Set-ItemProperty -Path $global:PersonalizationRegistryPath -Name ([VisualEffect]::TransparencySettingProperty) -Value $transparencyValue
}
}
}
}
Expand Down
Loading
Loading