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
2 changes: 0 additions & 2 deletions macos/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -4325,7 +4325,6 @@
"Tools" = "Tools";
"Tools sent" = "Tools sent";
"Total" = "Total";
"Total %@" = "Total %@";
"Total tokens: %@" = "Total tokens: %@";
"Tracking %@" = "Tracking %@";
"Tracking Branch" = "Tracking Branch";
Expand Down Expand Up @@ -9053,7 +9052,6 @@
"native.tools" = "Tools";
"native.toolsSent" = "Tools sent";
"native.total" = "Total";
"native.total.variant2" = "Total %1$@";
"native.totalTokens" = "Total tokens: %1$@";
"native.tracking" = "Tracking %1$@";
"native.trackingBranch" = "Tracking Branch";
Expand Down
2 changes: 0 additions & 2 deletions macos/Resources/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -4325,7 +4325,6 @@
"Tools" = "工具";
"Tools sent" = "发送的工具";
"Total" = "总计";
"Total %@" = "总计 %@";
"Total tokens: %@" = "总 token:%@";
"Tracking %@" = "跟踪 %@";
"Tracking Branch" = "跟踪的分支";
Expand Down Expand Up @@ -9053,7 +9052,6 @@
"native.tools" = "工具";
"native.toolsSent" = "发送的工具";
"native.total" = "总计";
"native.total.variant2" = "总计 %1$@";
"native.totalTokens" = "总 token:%1$@";
"native.tracking" = "跟踪 %1$@";
"native.trackingBranch" = "跟踪的分支";
Expand Down
14 changes: 14 additions & 0 deletions macos/Sources/Lithe/Theme/LitheTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,9 @@ enum LitheTheme {
static let toolbarHeight: CGFloat = 40
static let toolWindowHeaderHeight: CGFloat = 41
static let statusBarHeight: CGFloat = 24
// Status bar icon widgets stay inside the 24pt bar so neighbouring
// items do not inherit the 28pt tool-window hit box as empty gaps.
static let statusBarIconButtonSize: CGFloat = 18
static let cornerRadius: CGFloat = 5
static let popupShadowRadius: CGFloat = 30
static let popupShadowOffsetY: CGFloat = 14
Expand Down Expand Up @@ -1050,6 +1053,17 @@ extension View {
.lithePointer()
}

/// Compact icon button for status bar widgets; inherits the bar's
/// secondary text color instead of the tool-window foreground.
func litheStatusBarIconButton() -> some View {
self
.buttonStyle(LitheIconButtonStyle(
size: LitheTheme.Metrics.statusBarIconButtonSize,
foreground: LitheTheme.secondaryText,
cornerRadius: 4))
.lithePointer()
}

/// Shows the macOS pointing-hand cursor while an interactive control is
/// hovered. The push/pop pair is balanced even when a view disappears.
func lithePointer() -> some View {
Expand Down
32 changes: 12 additions & 20 deletions macos/Sources/Lithe/Views/Workbench/WorkbenchStatusViews.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ struct EditorCaretPositionLabel: View {
}
}

/// Icon-only memory indicator: the status bar keeps just the chip so the
/// figures do not crowd the bar; hover shows the totals and a click opens the
/// detailed breakdown.
struct MemoryUsageStatusView: View {
@EnvironmentObject private var memoryUsageMonitor: MemoryUsageMonitor
@State private var isMemoryUsagePopoverPresented = false
Expand All @@ -29,19 +32,11 @@ struct MemoryUsageStatusView: View {
Button {
isMemoryUsagePopoverPresented.toggle()
} label: {
Label {
HStack(spacing: 4) {
Text("Total \(memoryUsageMonitor.totalText)")
Text("·")
Text("Lithe \(memoryUsageMonitor.litheText)")
}
.monospacedDigit()
} icon: {
Image(systemName: "memorychip")
}
Image(systemName: "memorychip")
}
.buttonStyle(.litheNoPress)
.lithePointer()
.litheStatusBarIconButton()
.accessibilityLabel(Text("Managed Memory"))
.accessibilityValue(Text(memoryUsageMonitor.totalText))
.help(
Text(
"Total managed memory: \(memoryUsageMonitor.totalText)\n" +
Expand Down Expand Up @@ -134,17 +129,14 @@ struct MemoryUsageStatusView: View {
}
}

/// Text-only frame rate readout; the "FPS" unit already names the metric.
struct FrameRateStatusView: View {
@EnvironmentObject private var frameRateMonitor: FrameRateMonitor

var body: some View {
Label {
Text(frameRateMonitor.framesPerSecondText)
.monospacedDigit()
} icon: {
Image(systemName: "speedometer")
}
.help("Frames rendered per second")
.accessibilityLabel(Text("\(frameRateMonitor.framesPerSecond) frames per second"))
Text(frameRateMonitor.framesPerSecondText)
.monospacedDigit()
.help("Frames rendered per second")
.accessibilityLabel(Text("\(frameRateMonitor.framesPerSecond) frames per second"))
}
}
2 changes: 1 addition & 1 deletion macos/Sources/Lithe/Views/Workbench/WorkbenchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1825,7 +1825,7 @@ struct WorkbenchView: View {
} label: {
Image(systemName: model.activeDocument?.isReadOnly == true ? "lock.fill" : "lock.open")
}
.litheIconButton()
.litheStatusBarIconButton()
.disabled(model.activeDocument?.isReadOnly == true)
.help(LocalizedStringKey(
model.activeDocument?.isReadOnly == true ? "Read-only document" : "Save"
Expand Down
1 change: 0 additions & 1 deletion shared/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -9339,7 +9339,6 @@
"native.terminalActions": "Terminal actions",
"native.close": "Close {arg1}",
"native.startingModule": "Starting module...",
"native.total.variant2": "Total {arg1}",
"native.framesRenderedPerSecond": "Frames rendered per second",
"native.lldFramesPerSecond": "{arg1} frames per second",
"native.discardAndRetry": "Discard and Retry",
Expand Down
1 change: 0 additions & 1 deletion shared/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -9339,7 +9339,6 @@
"native.terminalActions": "终端操作",
"native.close": "关闭 {arg1}",
"native.startingModule": "正在启动模块…",
"native.total.variant2": "总计 {arg1}",
"native.framesRenderedPerSecond": "每秒渲染帧数",
"native.lldFramesPerSecond": "每秒 {arg1} 帧",
"native.discardAndRetry": "放弃并重试",
Expand Down
16 changes: 0 additions & 16 deletions shared/i18n/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -88094,22 +88094,6 @@
"arguments": []
}
},
{
"id": "native.total.variant2",
"description": "Native UI: Total %@",
"platforms": [
"macos"
],
"macos": {
"key": "Total %@",
"arguments": [
"arg1"
]
},
"parameters": {
"arg1": "string"
}
},
{
"id": "native.framesRenderedPerSecond",
"description": "Native UI: Frames rendered per second",
Expand Down
5 changes: 3 additions & 2 deletions shared/platform-feature-matrix/features/memory-monitor.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"capability": "应用与语言服务内存监控",
"macos": {
"evidence": [
"macos/Sources/Lithe/Services/Monitoring/MemoryUsageMonitor.swift"
"macos/Sources/Lithe/Services/Monitoring/MemoryUsageMonitor.swift",
"macos/Sources/Lithe/Views/Workbench/WorkbenchStatusViews.swift"
],
"implementationStatus": "implemented",
"verificationStatus": "pending"
Expand All @@ -19,5 +20,5 @@
"verificationStatus": "pending"
},
"owner": "Workbench",
"verification": "打开内存指标并观察应用、语言服务和总内存变化,确认采样失败不会阻塞工作台。"
"verification": "打开内存指标并观察应用、语言服务和总内存变化,确认采样失败不会阻塞工作台。macOS 状态栏只显示内存芯片图标,不再显示总计与 Lithe 数值;悬停提示显示总计、Lithe、LSP 和服务内存,点击图标打开托管内存详情并在关闭后停止详细采样,VoiceOver 读出托管内存及当前总计。同一状态栏中帧率只显示数字和 FPS 单位,不带图标;只读锁和内存图标按钮使用 18pt 紧凑尺寸,相邻项之间不再留出大块空白。Windows 状态栏仍显示总计与 Lithe 数值。"
}
Loading