RamonUnch/AltSnap

Feature request: Add option to disable Windows 11 rounded corners when snapped to a zone

Susko3 opened this issue · 1 comments

Inspired by PowerToys FancyZones.

I have my zones set up to be adjacent to screen edges. So having the corners rounded looks really weird. The default windows snap will also disable the rounded corners when a window is snapped to a screen edge. So I thought having this as an option could be useful!

The API for toggling corners is as below:

// Gets current corner preference, to save for when restoring/unsnapping a window out of a zone.
int cornerPreference = DWMWCP_DEFAULT; // the type needs to be `int`
DwmGetWindowAttributeL(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &cornerPreference, sizeof(cornerPreference));
// cornerPreference now has a value 0-3, as described in DWM_WINDOW_CORNER_PREFERENCE enum
// Disables rounded corners for the window, should last until the window is unsnapped from the zone.
int cornerPreference = DWMWCP_DONOTROUND;
DwmSetWindowAttributeL(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &cornerPreference, sizeof(cornerPreference));

I have made a POC branch that toggles Windows 11 corners with the 'Toggle borderless' action. I don't have the expertise to code this as I described, so I hope this proof of concept is useful!

I was not aware that Windows 11 was disabling the rounded corners when snapping (never used Win11). I am already familiar with those DWM flags but I still appreciate the help effort from your side.

I will make this an option and the option will be enabled by default because it is the native behavior.