How Win11Debloat Manages Snap Layouts and Window Snapping in Windows 11
Win11Debloat disables Windows 11's Snap Layouts and window snapping behaviors by importing specialized .reg files defined in Config/Features.json, using the ImportRegistryFile.ps1 helper to execute registry modifications via CLI switches like -DisableSnapLayouts and -DisableWindowSnapping.
Win11Debloat is an open-source PowerShell utility that removes bloatware and modifies core Windows 11 behaviors. The tool exposes fine-grained control over the operating system's multi-tasking snap features through a declarative JSON configuration and a dynamic registry import pipeline.
The Three Snap Features Controlled by Win11Debloat
Win11Debloat targets three distinct snapping capabilities, each controlled by a specific FeatureId defined in Config/Features.json and mapped to a dedicated .reg file in the Regfiles/ directory.
DisableWindowSnapping
The DisableWindowSnapping feature turns off the basic ability to snap windows to screen edges or corners using mouse drag or keyboard shortcuts. When activated via the -DisableWindowSnapping switch, the script imports Regfiles/Disable_Window_Snapping.reg to modify the underlying registry keys responsible for edge-snapping behavior.
DisableSnapAssist
The DisableSnapAssist feature suppresses the suggestion pane that appears while dragging a window, which normally shows thumbnails of other open windows to fill remaining screen space. This feature uses Regfiles/Disable_Snap_Assist.reg and is triggered by the -DisableSnapAssist parameter.
DisableSnapLayouts
The DisableSnapLayouts feature hides the Snap Layouts flyout that appears when hovering over the maximize button or dragging a window to the top of the screen. According to the source code in Config/Features.json, this feature defines both an action registry file (Disable_Snap_Layouts.reg) and an undo file (Enable_Snap_Layouts.reg), allowing users to later restore the maximize-button hover menu.
Architectural Implementation
The snap management system relies on a three-stage pipeline that separates configuration from execution.
Feature Catalog in Config/Features.json
Each snapping feature is declared as a JSON object in Config/Features.json with structured metadata that drives the UI and execution logic. The DisableSnapLayouts entry, for example, contains:
{
"FeatureId": "DisableSnapLayouts",
"Label": "snap layout flyout at top of screen and on maximize button",
"Category": "Multi-tasking",
"Action": "Hide",
"RegistryKey": "Disable_Snap_Layouts.reg",
"ApplyText": "Hiding snap layouts when dragging windows to top of the screen and on maximize button...",
"UndoAction": "Show",
"RegistryUndoKey": "Enable_Snap_Layouts.reg"
}
This declarative approach allows the script to reference RegistryKey for applying changes and RegistryUndoKey for reverting them without hard-coding file paths in the main logic.
CLI Switch Handling in Win11Debloat.ps1
The entry point script Win11Debloat.ps1 exposes explicit switches for each snap feature. When a user specifies -DisableWindowSnapping, -DisableSnapAssist, or -DisableSnapLayouts, the script adds the corresponding FeatureId to an internal list of selected operations. This list is then iterated to trigger the appropriate registry modifications.
Registry Import Execution
The actual registry modification is handled by Scripts/Features/ImportRegistryFile.ps1. For each selected feature containing a RegistryKey property, the main script invokes:
ImportRegistryFile "> $($feature.ApplyText)" $feature.RegistryKey
This helper function resolves the path against $script:RegfilesPath and executes reg import to apply the tweaks. The same pipeline handles undo operations by passing the RegistryUndoKey (such as Enable_Snap_Layouts.reg) when reverting changes.
Command-Line Usage Examples
Disable all snapping features simultaneously using individual switches:
.\Win11Debloat.ps1 -DisableWindowSnapping -DisableSnapAssist -DisableSnapLayouts
Programmatically select features by ID for batch processing:
$features = @('DisableWindowSnapping','DisableSnapAssist','DisableSnapLayouts')
.\Win11Debloat.ps1 -FeatureIds $features
Manually import a specific registry file without running the full script:
reg import "$PSScriptRoot/Regfiles/Disable_Snap_Layouts.reg"
Restore Snap Layouts using the built-in undo mechanism (via saved settings or GUI revert), which internally imports Regfiles/Enable_Snap_Layouts.reg.
Summary
- Win11Debloat controls three distinct snapping behaviors: DisableWindowSnapping, DisableSnapAssist, and DisableSnapLayouts.
- Feature definitions live in
Config/Features.json, which maps eachFeatureIdto specific.regfiles in theRegfiles/directory. - The
ImportRegistryFile.ps1helper executesreg importcommands based on JSON metadata, supporting both apply and undo operations viaRegistryKeyandRegistryUndoKeyproperties. - Users trigger modifications through CLI switches (
-DisableSnapLayouts) or by passing feature arrays to the script parameters.
Frequently Asked Questions
What registry files does Win11Debloat use to disable Snap Layouts?
Win11Debloat uses Regfiles/Disable_Snap_Layouts.reg to hide the Snap Layouts flyout, Regfiles/Disable_Snap_Assist.reg to disable the suggestion pane, and Regfiles/Disable_Window_Snapping.reg to turn off basic edge-snapping functionality. Each file contains specific registry values that modify Windows 11's multi-tasking behavior.
Can I re-enable Snap Layouts after disabling them with Win11Debloat?
Yes. Each feature defines a RegistryUndoKey in Config/Features.json. For Snap Layouts, the script imports Regfiles/Enable_Snap_Layouts.reg when you run the undo action through the GUI or use the saved settings revert functionality. This restores the maximize-button hover menu and top-edge dragging behavior.
How do I disable all window snapping features at once?
Execute the main script with all three snap-related switches: .\Win11Debloat.ps1 -DisableWindowSnapping -DisableSnapAssist -DisableSnapLayouts. This command adds all three feature IDs to the processing queue and imports the corresponding registry files sequentially via the ImportRegistryFile.ps1 pipeline.
Is it safe to manually import the registry files outside the script?
Yes. The .reg files in the Regfiles/ directory are standard Windows registry files. You can manually apply them using reg import "path/to/Disable_Snap_Layouts.reg" from an elevated PowerShell or Command Prompt window. However, using the script ensures proper path resolution and provides undo capabilities through the structured JSON configuration.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →