fix: the system theme obtained is always light (#1091)

* fix(macos): the system theme obtained is always light (https://github.com/tauri-apps/tauri/issues/12894)

Signed-off-by: The1111mp <The1111mp@outlook.com>

* add change file

---------

Signed-off-by: The1111mp <The1111mp@outlook.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
The1111mp
2025-03-07 18:39:51 +08:00
committed by GitHub
parent 996e28dfe1
commit dd9251a8f0
2 changed files with 6 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"tao": patch
---
Fix `Window::theme()` always returning `Theme::Light` and `WindowEvent::ThemeChanged()` not delivered on macOS.

View File

@@ -332,7 +332,7 @@ pub(super) fn get_ns_theme() -> Theme {
let app_class = class!(NSApplication);
let app: id = msg_send![app_class, sharedApplication];
let has_theme: bool = msg_send![app, respondsToSelector: sel!(effectiveAppearance)];
if has_theme {
if !has_theme {
return Theme::Light;
}
let appearance: id = msg_send![app, effectiveAppearance];