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
4 changes: 2 additions & 2 deletions Packages/macOS/CmuxNext/Sources/CmuxNextApp/AppActions.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import AppKit
import CmuxNextActions
import CmuxNextAgentLanes
import CmuxNextBridge
import CmuxNextDaemon
import CmuxNextDesign
Expand Down Expand Up @@ -121,8 +122,7 @@ enum AppActions {
// One owner per action: a second binding silently replaces the first. The check is a test
// (noActionIsBoundTwice); at runtime a Debug dogfood build must not crash, so only a fault.
if !registry.duplicateBindings.isEmpty {
Logger(subsystem: "com.cmuxterm.app.next", category: "actions")
.fault("actions bound twice: \(registry.duplicateBindings.map(\.rawValue).joined(separator: ", "), privacy: .public)")
Logger(subsystem: "com.cmuxterm.app.next", category: "actions").fault("actions bound twice: \(registry.duplicateBindings.map(\.rawValue).joined(separator: ", "), privacy: .public)")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ final class SidebarPriorityRowView: NSView {
var onAction: ((SidebarPriorityAction) -> Void)?

private let title = ChromeLabel(labelWithString: "")
private let tag = ChromeLabel(labelWithString: "")
private let placeLabel = ChromeLabel(labelWithString: "")
private let preview = ChromeLabel(wrappingLabelWithString: "")
private let chip = ChromeLabel(labelWithString: "")
private let indicator = StatusIndicatorView()
Expand All @@ -27,10 +27,10 @@ final class SidebarPriorityRowView: NSView {
super.init(frame: .zero)
wantsLayer = true
title.lineBreakMode = .byTruncatingTail
tag.lineBreakMode = .byTruncatingTail
placeLabel.lineBreakMode = .byTruncatingTail
preview.maximumNumberOfLines = 2
preview.truncatesLastVisibleLine = true
[title, tag, preview, chip, indicator].forEach(addSubview)
[title, placeLabel, preview, chip, indicator].forEach(addSubview)
layer?.addSublayer(unreadDot)
for button in actionButtons { addSubview(button) }
markRead.onPress = { [weak self] in self.map { $0.onAction?(.markRead($0.entry.id)) } }
Expand All @@ -53,7 +53,7 @@ final class SidebarPriorityRowView: NSView {
func configure(_ entry: SidebarPriorityEntry) {
self.entry = entry
title.stringValue = entry.title
tag.stringValue = [entry.project, entry.machine].compactMap(\.self).joined(separator: " · ")
placeLabel.stringValue = [entry.project, entry.machine].compactMap(\.self).joined(separator: " · ")
preview.stringValue = entry.preview ?? ""
preview.isHidden = entry.preview == nil
chip.stringValue = Self.chipText(entry.state, now: Date())
Expand Down Expand Up @@ -116,7 +116,7 @@ final class SidebarPriorityRowView: NSView {
super.layout()
let b = bounds, inset = SidebarStyle.horizontalInset, pad = Metrics.space2
title.font = SidebarStyle.titleFont
tag.font = SidebarStyle.titleFont
placeLabel.font = SidebarStyle.titleFont
preview.font = SidebarStyle.subtitleFont
chip.font = SidebarStyle.subtitleFont
let lineHeight = ceil(SidebarStyle.titleFont.boundingRectForFont.height)
Expand Down Expand Up @@ -148,18 +148,18 @@ final class SidebarPriorityRowView: NSView {
if entry.unread { trailing = unreadDot.frame.minX - Metrics.space1 }
}
let textWidth = max(0, trailing - inset)
let tagWidth = tag.stringValue.isEmpty ? 0 : min(tag.naturalSize.width, textWidth * 0.4)
let tagWidth = placeLabel.stringValue.isEmpty ? 0 : min(placeLabel.naturalSize.width, textWidth * 0.4)
let titleWidth = min(title.naturalSize.width, textWidth - tagWidth - (tagWidth > 0 ? Metrics.space2 : 0))
title.frame = NSRect(x: inset, y: pad, width: max(0, titleWidth), height: lineHeight)
tag.frame = NSRect(x: title.frame.maxX + Metrics.space2, y: pad, width: tagWidth, height: lineHeight)
placeLabel.frame = NSRect(x: title.frame.maxX + Metrics.space2, y: pad, width: tagWidth, height: lineHeight)
let previewTop = pad + lineHeight + Metrics.space1
preview.frame = NSRect(x: inset, y: previewTop, width: max(0, b.width - 2 * inset), height: max(0, b.height - previewTop - pad))
}

override func updateLayer() {
performWithTheme {
title.textColor = Palette.textPrimary
tag.textColor = entry.machine.map(Self.machineColor) ?? Palette.textTertiary
placeLabel.textColor = entry.machine.map(Self.machineColor) ?? Palette.textTertiary
preview.textColor = Palette.textSecondary
chip.textColor = switch entry.state {
case .needsYou: Palette.attention
Expand Down