mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-15 05:40:47 +08:00
fix(macos): sync tray speed style across displays
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
### 🐞 修复问题
|
||||
|
||||
修复 macOS 多显示器切换时托盘速率样式不同步
|
||||
|
||||
<details>
|
||||
<summary><strong> ✨ 新增功能 </strong></summary>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! macOS 托盘速率富文本渲染模块
|
||||
//!
|
||||
//! 通过 objc2 调用 NSAttributedString 实现托盘速率的富文本显示,
|
||||
//! 支持等宽字体、自适应深色/浅色模式配色、两行定宽布局。
|
||||
//! 支持等宽字体、跟随菜单栏外观配色、两行定宽布局。
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
||||
@@ -56,8 +56,8 @@ fn build_attributes(button_height: f64) -> Retained<NSDictionary<NSString, AnyOb
|
||||
unsafe {
|
||||
// 等宽系统字体,确保数字不跳动
|
||||
let font = NSFont::monospacedSystemFontOfSize_weight(TRAY_FONT_SIZE, NSFontWeightRegular);
|
||||
// 自适应标签颜色(自动跟随深色/浅色模式)
|
||||
let color = NSColor::labelColor();
|
||||
// 与 NSStatusBarButton 原生标题一致,并按每块屏幕的菜单栏外观动态解析颜色
|
||||
let color = NSColor::controlTextColor();
|
||||
// 段落样式:右对齐,保证定宽视觉一致
|
||||
let para_style = NSMutableParagraphStyle::new();
|
||||
para_style.setAlignment(NSTextAlignment::Right);
|
||||
|
||||
Reference in New Issue
Block a user