From 74196f38b5f50fbcb30e336b50e31f1640ed61f4 Mon Sep 17 00:00:00 2001 From: zhiyiYo <1319158137@qq.com> Date: Wed, 9 Aug 2023 09:22:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=87=E6=8D=A2=20Mica=20?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E6=97=A0=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20(#112)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qframelesswindow/__init__.py | 2 +- qframelesswindow/linux/window_effect.py | 5 ++++- qframelesswindow/mac/window_effect.py | 5 ++++- qframelesswindow/windows/window_effect.py | 2 ++ setup.py | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/qframelesswindow/__init__.py b/qframelesswindow/__init__.py index d321999..f966aba 100644 --- a/qframelesswindow/__init__.py +++ b/qframelesswindow/__init__.py @@ -12,7 +12,7 @@ :license: GPLv3, see LICENSE for more details. """ -__version__ = "0.3.0" +__version__ = "0.3.1" import sys diff --git a/qframelesswindow/linux/window_effect.py b/qframelesswindow/linux/window_effect.py index d33541d..485e296 100644 --- a/qframelesswindow/linux/window_effect.py +++ b/qframelesswindow/linux/window_effect.py @@ -25,13 +25,16 @@ def setAcrylicEffect(self, hWnd, gradientColor="F2F2F230", isEnableShadow=True, """ pass - def setMicaEffect(self, hWnd): + def setMicaEffect(self, hWnd, isDarkMode=False): """ Add mica effect to the window (Win11 only) Parameters ---------- hWnd: int or `sip.voidptr` Window handle + + isDarkMode: bool + whether to use dark mode mica effect """ pass diff --git a/qframelesswindow/mac/window_effect.py b/qframelesswindow/mac/window_effect.py index fbce218..b266b38 100644 --- a/qframelesswindow/mac/window_effect.py +++ b/qframelesswindow/mac/window_effect.py @@ -46,13 +46,16 @@ def setAcrylicEffect(self, hWnd, gradientColor="F2F2F230", isEnableShadow=True, content.addSubview_positioned_relativeTo_( visualEffectView, Cocoa.NSWindowBelow, container) - def setMicaEffect(self, hWnd): + def setMicaEffect(self, hWnd, isDarkMode=False): """ Add mica effect to the window (Win11 only) Parameters ---------- hWnd: int or `sip.voidptr` Window handle + + isDarkMode: bool + whether to use dark mode mica effect """ self.setAcrylicEffect(hWnd) diff --git a/qframelesswindow/windows/window_effect.py b/qframelesswindow/windows/window_effect.py index 4180bc9..ba92c61 100644 --- a/qframelesswindow/windows/window_effect.py +++ b/qframelesswindow/windows/window_effect.py @@ -114,6 +114,8 @@ def setMicaEffect(self, hWnd, isDarkMode=False): else: self.DwmSetWindowAttribute(hWnd, 38, byref(c_int(2)), 4) + self.DwmSetWindowAttribute(hWnd, 20, byref(c_int(1*isDarkMode)), 4) + def setAeroEffect(self, hWnd): """ Add the aero effect to the window diff --git a/setup.py b/setup.py index 0af4d11..1882446 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setuptools.setup( name="PyQt5-Frameless-Window", - version="0.3.0", + version="0.3.1", keywords="pyqt frameless", author="zhiyiYo", author_email="shokokawaii@outlook.com",