fix(mac): size context bar to menu

This commit is contained in:
Peter Steinberger
2025-12-13 00:23:00 +00:00
parent 3bb33bdeed
commit 5e51107711
4 changed files with 54 additions and 11 deletions

View File

@@ -17,6 +17,7 @@ struct MenuContent: View {
@State private var loadingMics = false
@State private var sessionMenu: [SessionRow] = []
@State private var mainSessionRow: SessionRow?
@State private var mainSessionContextWidth: CGFloat = 0
var body: some View {
VStack(alignment: .leading, spacing: 8) {
@@ -266,9 +267,15 @@ struct MenuContent: View {
ContextUsageBar(
usedTokens: row.tokens.total,
contextTokens: row.tokens.contextTokens,
width: 220)
width: self.mainSessionContextWidth > 0 ? self.mainSessionContextWidth : nil)
}
.padding(.vertical, 2)
.onWidthChange { width in
let next = max(120, width)
if abs(next - self.mainSessionContextWidth) > 1 {
self.mainSessionContextWidth = next
}
}
} else {
HStack(spacing: 8) {
Text("Context (main)")