Skip to content

Commit

Permalink
feat(blur): enhance Blur function to support corner type customizatio…
Browse files Browse the repository at this point in the history
…n on non-Windows 10
  • Loading branch information
amnweb committed Jan 10, 2025
1 parent f6688c4 commit f35e5db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/utils/win32/blurWindow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ctypes
from ctypes.wintypes import HWND

from core.utils.utilities import is_windows_10
user32 = ctypes.windll.user32
dwm = ctypes.windll.dwmapi

Expand Down Expand Up @@ -98,7 +98,7 @@ def set_window_corner_preference(hwnd, preference, border_color):
if result != 0:
raise ctypes.WinError()

def Blur(hwnd, Acrylic=False, DarkMode=False, RoundCorners=False, BorderColor="System"):
def Blur(hwnd, Acrylic=False, DarkMode=False, RoundCorners=False, RoundCornersType="normal", BorderColor="System"):
"""Apply blur, dark mode, and corner preferences to a window."""
hwnd = int(hwnd)
try:
Expand All @@ -110,7 +110,7 @@ def Blur(hwnd, Acrylic=False, DarkMode=False, RoundCorners=False, BorderColor="S
if DarkMode:
set_dark_mode(hwnd)

if RoundCorners:
set_window_corner_preference(hwnd, DWMWCP_ROUND, BorderColor)
if RoundCorners and not is_windows_10():
set_window_corner_preference(hwnd, DWMWCP_ROUND if RoundCornersType == "normal" else DWMWCP_ROUNDSMALL, BorderColor)
except Exception as e:
print(f"Failed to apply settings: {e}")

0 comments on commit f35e5db

Please sign in to comment.