Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src-tauri/src/menubar/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1119,12 +1119,11 @@ define_class!(
unsafe impl NSMenuDelegate for Target {
#[unsafe(method(menuWillOpen:))]
fn menu_will_open(&self, menu: &NSMenu) {
// **菜单跟菜单栏的深浅走**,不跟应用内选的外观 —— 和系统其他菜单栏菜单一样
// **菜单跟应用内选的外观走**(跟随系统时就是系统的深浅模式),不跟菜单栏
// —— macOS 26 的菜单栏透明,深浅随壁纸变:深色模式配亮壁纸时它是浅的。
// 显式设上,不留给 AppKit 去推断状态栏菜单该继承谁
let mtm = MainThreadMarker::from(self);
let bar = UI.with(|ui| ui.borrow().as_ref().and_then(|ui| ui.item.button(mtm)));
if let Some(button) = bar {
menu.setAppearance(Some(&button.effectiveAppearance()));
}
menu.setAppearance(Some(&NSApplication::sharedApplication(mtm).effectiveAppearance()));
OPEN.with(|o| o.set(true));
if let Some(f) = ON_OPEN.with(|o| o.borrow().clone()) {
f(true);
Expand Down
3 changes: 2 additions & 1 deletion src-tauri/src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
//!
//! 代价是它在 macOS 上是应用级的(Tauri 的 `set_theme` 文档写明了),不是
//! 单个窗口的 —— 对一个只有一个窗口的应用来说,正是想要的那个范围。菜单栏
//! 上那个图标不受影响:它是模板图,靠 alpha 跟随菜单栏自己的亮暗。
//! 点开的那份菜单也跟着它(`menubar::macos` 打开时设上);菜单栏上那个图标
//! 不受影响:它是模板图,靠 alpha 跟随菜单栏自己的亮暗。
//!
//! **Linux 上换的是 GTK 的 `gtk-application-prefer-dark-theme`。**tao 的
//! `set_theme` 写的就是这一项(进程级),WebKitGTK 按它定
Expand Down
Loading