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

FR: debloat magnifier tool #75

Open
aminihasehem opened this issue Feb 20, 2025 · 1 comment
Open

FR: debloat magnifier tool #75

aminihasehem opened this issue Feb 20, 2025 · 1 comment

Comments

@aminihasehem
Copy link

Hello
There are some tools in Settings> accessibility, that are not used by most users like magnifier, eye control,...
Although these are deactivated by default, but it would be better to have an option to completely remove them.

@Nigel1992
Copy link

Here's how we can implement this functionality:

1. UI Changes

First, we added a new checkbox to the Optimize screen in the XAML:

<!-- Accessibility Features -->
<Border Background="{DynamicResource ContentSectionBorderBrush}" CornerRadius="5" Margin="5,5,5,5" Effect="{StaticResource LightShadowEffect}">
    <StackPanel Orientation="Horizontal" Margin="10">
        <TextBlock Style="{DynamicResource HelpIconStyle}" Margin="0,0,10,0">
            <TextBlock.ToolTip>
                <ToolTip Style="{DynamicResource CustomTooltipStyle}">
                    <TextBlock>
                    Removes:
<LineBreak />- Magnifier
<LineBreak />- Narrator
<LineBreak />- Eye Control
<LineBreak />- Text Input Management
<LineBreak />- Sticky Keys
<LineBreak />- Toggle Keys
<LineBreak />- Filter Keys
<LineBreak />- Mouse Keys
<LineBreak />- On-Screen Keyboard
                    </TextBlock>
                </ToolTip>
            </TextBlock.ToolTip>
        </TextBlock>
        <CheckBox x:Name="AccessibilityCheckBox"
                 Content="Accessibility Features"
                 Style="{DynamicResource CustomCheckBoxStyle}"
                 FontSize="14"/>
    </StackPanel>
</Border>

2. Control Initialization

Added the checkbox to the initialization section:

# Optimize Checkboxes
$optimizeSelectAllCheckbox = $window.FindName("OptimizeSelectAllCheckbox")
$accessibilityCheckBox = $window.FindName("AccessibilityCheckBox")  # New checkbox

# Add to checkbox array
$optimizeCheckboxes = @(
    $privacyCheckBox,
    $gamingOptimizationsCheckBox,
    $windowsUpdatesCheckBox,
    $powerSettingsCheckBox,
    $accessibilityCheckBox  # Added to array
)

3. Implementation

Added the removal functionality to the Optimize Apply Button handler:

if ($accessibilityCheckBox.IsChecked) {
    Write-Status "Removing unused accessibility features..." -TargetScreen OptimizeScreen
    Update-WPFControls
    
    # List of features to remove
    $features = @(
        "Magnifier"
        "Narrator"
        "EyeControl"
        "TextInputManagement"
        "StickyKeys"
        "ToggleKeys"
        "FilterKeys"
        "MouseKeys"
        "OnScreenKeyboard"
    )
    
    foreach ($feature in $features) {
        try {
            $capability = Get-WindowsCapability -Online | Where-Object { $_.Name -like "*$feature*" }
            if ($capability) {
                Remove-WindowsCapability -Online -Name $capability.Name -ErrorAction Stop
            }
        } catch {
            Write-Log -Message "Failed to remove $feature - $($_.Exception.Message)" -Severity 'WARNING'
        }
    }
    
    $results.Accessibility = $true
}

Features Removed

The implementation removes these accessibility features:

  • Magnifier
  • Narrator
  • Eye Control
  • Text Input Management
  • Sticky Keys
  • Toggle Keys
  • Filter Keys
  • Mouse Keys
  • On-Screen Keyboard

Error Handling & User Feedback

  • Each feature removal is handled separately
  • Failures are logged but don't stop the process
  • Users get feedback about successful/failed removals
  • All actions are logged for troubleshooting
  • Status updates shown in the UI
  • Detailed completion message
  • Error messages if something goes wrong

Notes

  1. Features can be reinstalled through Windows Features if needed
  2. System restart recommended after removal
  3. Some features might not be present on all systems
  4. Admin privileges required for removal

Example Output

Optimization completed:
[+] Privacy settings optimized
[+] Gaming optimizations applied
[+] Windows Update settings configured
[+] Power settings optimized for performance
[+] Unused accessibility features removed

Please restart your computer for all changes to take effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants