## Summary of the Pull Request
Adds a new Hosts File Editor setting “No leading spaces” that prevents
prepending spaces to active lines when saving the hosts file (when any
entry is disabled). Default is Off to preserve current behavior.
## PR Checklist
- [x] Closes: #36386
- [ ] Communication: N/A (small, scoped option)
- [x] Tests: Added/updated and all pass
- [x] Localization: New en-US strings added; other locales handled by
loc pipeline
- [ ] Dev docs: N/A
- [x] New binaries: None
- [x] Documentation updated: N/A
## Detailed Description of the Pull Request / Additional comments
- Settings surface:
- `src/settings-ui/Settings.UI.Library/HostsProperties.cs`: add
`NoLeadingSpaces`
- `src/modules/Hosts/HostsUILib/Settings/IUserSettings.cs`: add
`NoLeadingSpaces`
- `src/modules/Hosts/Hosts/Settings/UserSettings.cs`: load/save value
from settings.json
- `src/settings-ui/Settings.UI/ViewModels/HostsViewModel.cs`: expose
`NoLeadingSpaces`
- `src/settings-ui/Settings.UI/SettingsXAML/Views/HostsPage.xaml`: new
SettingsCard toggle
- `src/settings-ui/Settings.UI/Strings/en-us/Resources.resw`: add
`Hosts_NoLeadingSpaces.Header/Description`
- Writer change:
- `src/modules/Hosts/HostsUILib/Helpers/HostsService.cs`: gate indent
with `anyDisabled && !_userSettings.NoLeadingSpaces`
- Tests:
- `src/modules/Hosts/Hosts.Tests/HostsServiceTest.cs`:
`NoLeadingSpaces_Disabled_RemovesIndent`
Backward compatibility: default Off, current formatting unchanged unless
the user enables the option.
## Validation Steps Performed
- Automated: `HostsEditor.UnitTests` including
`NoLeadingSpaces_Disabled_RemovesIndent` passing.
- Manual:
1. Run PowerToys (runner) as Admin.
2. Settings → Hosts File Editor → enable “No leading spaces”.
3. In editor, add active `127.0.0.10 example1` and disabled
`127.0.0.11 example2`; Save.
4. Open `C:\Windows\System32\drivers\etc\hosts` in Notepad.
- ON: active line starts at column 0; disabled is `# 127...`.
- OFF: active line begins with two spaces when a disabled entry
exists.
## Summary of the Pull Request
Removes all C++/CX code, replacing it with C++/WinRT.
## Detailed Description of the Pull Request / Additional comments
Removes all C++/CX code.
Renames interop namespaces to be better consumed by CsWinRT.
Standardizes all projects on net8.0-windows10.0.20348.0, which is a
requirement for C++/WinRT usage.
FileLocksmithLibInterop brought to stdcpplatest and static analysis
errors were corrected.
Removed now unneeded string conversion code from
FileLocksmithLibInterop.
Changed interop KeyboardHook to use a single hook across all instances.
Required because on C++/WinRT we don't have the .NET runtime to bind a
object instance to a delegate and be able to pass it to a C function
pointer argument (still no idea why this worked correctly on C++/CX to
be honest). This change actually makes us create less low level keyboard
hooks.
Changed some code that depended on arrays since WinRT/C++ returns null
instead of an empty array through the interface.
## Validation Steps Performed
Built and tested runtime.
* Init
* Fix running settings
* UI design
* Left click trigger
Wire up colorpicker and pt run
* Wire up others
* Update FlyoutWindow.xaml.cs
* Removed comments
* Update FlyoutWindow.xaml
* More work
* Open Settings page
* More UI work
* Resolve conflicts
* [General] SystemTray Flyout: Add update on tray items' visibility when module gets enabled/disabled
Also remove context menu opening on tray icon.
* Adding app list
* Adding more buttons, resolving conflicts
* [General] Flyout: improving opening, closing flyout/settings window. Implementing basic bahaviour on enabling/disabling modules.
* [General] FlyoutWindow: proceed with implementation. GPO works. Main functionallity works (launching and enabling apps).
* [general] flyout: fix exit button
* [general] flyout: implement double click handling
* Localization
* [Generel] Flyout: Re-implement flyout launching, add workaround: disable flyout hiding in case the user switches on modules on the all apps page
+ minor changes
* [general] flyout: restore the context menu when right clicking on system tray icon
* Fix spellchecker
* [installer] fixing missing dll files + suppress error on not signed script
* Fix spell checker
* Fix flyout not focusing when activated
* Refresh Settings UI enabled state when flyout changes
* fix spellcheck
* Remove VCM from the list
* [General] flyout: fix settings window opening. Switch to general page only if there is no page opened
* [general] flyout: add launching hosts app
* Fix CI build
* adding check on elevation when launching hosts
* Use localization strings that already exist
* Remove dll not present in arm64 build
* Adding GPO policy check for the launcher page items
* fix hosts launching
* Add telemetry
* Also hide from all apps list when gpo is force enabling
* fix spellchecker
* Improve focus issues
* Fix flickering Bitmap Icons
* Fix telemetry error
* Fix telemetry call
* Fix wrong comment
---------
Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
Co-authored-by: Laszlo Nemeth <laszlo.nemeth.hu@gmail.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
* Add GPOWrapper headers and C++/WinRT library
* Check GPO before starting utilities
* Show message on GPO having disabled preview panes.
* Don't generate thumbnails if GPO disabled
* Fix FancyZonesEditor unable to recognize GPOWrapper
* Move settings view models to the settings project
* Use GPO to block enabling utilities in Settings
* Hide context menu entries when gpo disables utilities
* Apply gpo policies when enabling PowerToys on runner
* Add version and metadata to dll
* Add GPOWrapper to the installer
* Fix MSBuild errors on WPF apps by using Projection
* Signing
* Add gpo files and publish them
* Add GPO policies to the bug report tool
* Add some documentation for using GPO
* Mention support to actual lowest supported version of Windows
* Move PowerToys to the root of administrative templates tree
* Save policies on Software\Policies\PowerToys
* Support both machine and user scopes
* Fix documentation to reference computer and user scopes
* Mention incompatibility with outlook in gpo
* Set a better folder structure for gpo assets
* Move PDF Handler warning to the description
* Update doc/gpo/README.md
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
* Add actual minimum version of PowerToys to gpo files
* Fix identation
* Remove GPOWrapper Readme
* Add Active Directory instructions to doc
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>