A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.
Swift ai-agentsanthropicantigravityclaudeclaude-codecodexcursordynamic-islandgemini-cliiosiphonlinuxmacosmacos-appmenubar-appnotchopen-sourceswiftswiftuiwindows
Question card: show the full question and the option descriptions
mehdifessiane52b156213722
diff --git a/NotchBuddy/Sources/App/AppState.swift b/NotchBuddy/Sources/App/AppState.swiftindex 4a1047e9..bcb47524 100644--- a/NotchBuddy/Sources/App/AppState.swift+++ b/NotchBuddy/Sources/App/AppState.swift@@ -328,7 +328,9 @@ final class AppState: ObservableObject {@Published var pendingApproval: ApprovalInfo? = nil// Pending AskUserQuestion from Claude Code hook- @Published var pendingQuestion: AskQuestion? = nil+ @Published var pendingQuestion: AskQuestion? = nil {+ didSet { QuestionLayout.height = pendingQuestion?.estimatedIslandHeight }+ }// Per-pill flat list of FileDiffs, in order of reception.// Not @Published — steps[] changes already trigger redraws.diff --git a/NotchBuddy/Sources/App/AskQuestion.swift b/NotchBuddy/Sources/App/AskQuestion.swiftindex e3e7266f..d4810c2e 100644--- a/NotchBuddy/Sources/App/AskQuestion.swift+++ b/NotchBuddy/Sources/App/AskQuestion.swift@@ -14,9 +14,41 @@ struct AskQuestionItem: Equatable {var multiSelect: Bool}+/// Island height of the pending question, readable from the nonisolated `islandSize`. Written on the main actor only.+enum QuestionLayout {+ nonisolated(unsafe) static var height: CGFloat?+}++extension AskQuestionItem {+ /// True when at least one option carries a description: the card then lists options vertically.+ var hasDescriptions: Bool { options.contains { !$0.description.isEmpty } }+}+struct AskQuestion: Equatable {var questions: [AskQuestionItem] // 1–4 questions+ /// Island height that fits the tallest question without truncation (rough estimate, text wraps at ~500 pt).+ var estimatedIslandHeight: CGFloat {+ func lines(_ text: String, charWidth: CGFloat) -> CGFloat {+ max(1, (CGFloat(text.count) * charWidth / 500).rounded(.up))+ }+ let tallest = questions.map { item -> CGFloat in+ var h: CGFloat = 20 + lines(item.question, charWidth: 7) * 17 + 64+ if !item.header.isEmpty { h += 14 }+ if item.hasDescriptions {+ for opt in item.options {+ h += 34 + (opt.description.isEmpty ? 0 : lines(opt.description, charWidth: 6.4) * 14)+ }+ h += 40 // "Other…" row+ } else {+ h += item.options.count >= 3 ? 74 : 40+ }+ if item.multiSelect { h += 34 }+ return h+ }.max() ?? 160+ return min(max(tallest, 160), 560)+ }+// MARK: - Parse from tool_input dict// Returns nil if the payload is malformed (fallback → Allow/Deny card).static func parse(toolInput: [String: Any]) -> AskQuestion? {diff --git a/NotchBuddy/Sources/App/IslandViewContent.swift b/NotchBuddy/Sources/App/IslandViewContent.swiftindex 3947f0d6..00a8beb5 100644--- a/NotchBuddy/Sources/App/IslandViewContent.swift+++ b/NotchBuddy/Sources/App/IslandViewContent.swift@@ -378,7 +378,7 @@ struct QuestionView: View {Text(item.question).font(.system(size: 13, weight: .semibold)).foregroundColor(Color(hex: "#F5F6F8"))- .lineLimit(2)+ .fixedSize(horizontal: false, vertical: true)// Options (wrapping) or "Other…" compact inline rowif curOther {HStack(spacing: 6) {@@ -412,6 +412,42 @@ struct QuestionView: View {.buttonStyle(.plain).foregroundColor(Color(hex: "#6B7079"))}+ } else if item.hasDescriptions {+ VStack(alignment: .leading, spacing: 6) {+ ForEach(Array(item.options.enumerated()), id: \.offset) { idx, opt in+ let isSelected = curSel.contains(opt.label)+ Button {+ if isMulti {+ toggleSelection(qi: qi, label: opt.label)+ } else {+ selectAndProceed(q: q, qi: qi, label: opt.label, isLast: isLast)+ }+ } label: {+ VStack(alignment: .leading, spacing: 2) {+ Text(opt.label)+ .font(.system(size: 12, weight: .medium))+ .foregroundColor(isSelected ? Color(hex: "#67E8F9") : Color(hex: "#F5F6F8"))+ if !opt.description.isEmpty {+ Text(opt.description)+ .font(.system(size: 11))+ .foregroundColor(Color(hex: "#9AA0A8"))+ .multilineTextAlignment(.leading)+ .fixedSize(horizontal: false, vertical: true)+ }+ }+ .frame(maxWidth: .infinity, alignment: .leading)+ .padding(.horizontal, 10).padding(.vertical, 6)+ .background(isSelected ? Color(hex: "#22D3EE").opacity(0.22) : Color.white.opacity(0.07))+ .clipShape(RoundedRectangle(cornerRadius: 8))+ .overlay(RoundedRectangle(cornerRadius: 8).stroke(isSelected ? Color(hex: "#22D3EE").opacity(0.55) : Color.white.opacity(0.1), lineWidth: 1))+ }+ .buttonStyle(.plain)+ .keyboardShortcut(KeyEquivalent(Character(String(idx + 1))), modifiers: [])+ }+ SecondaryButton("Other…") {+ if qi < showOther.count { showOther[qi] = true }+ }+ }} else {ChipFlowLayout(spacing: 6) {ForEach(Array(item.options.enumerated()), id: \.offset) { idx, opt indiff --git a/NotchBuddy/Sources/App/IslandWindowController.swift b/NotchBuddy/Sources/App/IslandWindowController.swiftindex c49e37ff..ebc94d5a 100644--- a/NotchBuddy/Sources/App/IslandWindowController.swift+++ b/NotchBuddy/Sources/App/IslandWindowController.swift@@ -57,7 +57,7 @@ final class IslandWindowController: NSWindowController {let nH = geometry.heightlet panelW: CGFloat = 720- let panelH: CGFloat = 320+ let panelH: CGFloat = 560let sf = screen.framelet panel = IslandPanel(contentRect: NSRect(x: sf.midX - panelW/2, y: sf.maxY - panelH,@@ -1149,6 +1149,9 @@ func islandSize(mode: IslandMode, view: IslandView,case .compact: return (nw + 160, nh)case .expanded:let layout = IslandConst.viewLayouts[view]!+ if view == .question, let h = QuestionLayout.height {+ return (IslandConst.expandedWidth, h)+ }return (IslandConst.expandedWidth, layout.height)}}diff --git a/tests/AskQuestionTests.swift b/tests/AskQuestionTests.swiftindex 981b7242..75a013a2 100644--- a/tests/AskQuestionTests.swift+++ b/tests/AskQuestionTests.swift@@ -109,6 +109,23 @@ enum AskQuestionTests {let ans3 = AskQuestion.buildAnswers(questions: items, selections: [[], []])checkTrue("all empty → empty dict", ans3.isEmpty)+ // ── island height ──────────────────────────────────────────────────────+ print("\nAskQuestion.estimatedIslandHeight")+ let shortQ = AskQuestionItem(question: "Which one?", header: "", options: [+ AskQuestionOption(label: "A", description: ""), AskQuestionOption(label: "B", description: "")+ ], multiSelect: false)+ let longQ = AskQuestionItem(question: String(repeating: "very long question ", count: 12), header: "Test", options: [+ AskQuestionOption(label: "A", description: String(repeating: "explanation ", count: 12)),+ AskQuestionOption(label: "B", description: "short"),+ AskQuestionOption(label: "C", description: "short"),+ AskQuestionOption(label: "D", description: "short")+ ], multiSelect: true)+ checkTrue("chips only → no descriptions", !shortQ.hasDescriptions)+ checkTrue("one description → vertical list", longQ.hasDescriptions)+ checkTrue("short question keeps the 160 pt floor", AskQuestion(questions: [shortQ]).estimatedIslandHeight == 160)+ let tall = AskQuestion(questions: [shortQ, longQ]).estimatedIslandHeight+ checkTrue("tallest question wins, within cap", tall > 160 && tall <= 560)+// ── finish ─────────────────────────────────────────────────────────────if failures == 0 {print("\nAll tests passed.")