Up-arrow (and toggle hotkey) folds chat/terminal back into the notch even while held open

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maksarsanjeev
2026-10-07 15:28:42 +03:00
parent 56367ef9cd
commit a92bf02477
2 changed files with 13 additions and 6 deletions
+1 -1
View File
@@ -563,7 +563,7 @@ struct IslandHeader: View {
Button(action: { Button(action: {
state.chatDragHeight = nil state.chatDragHeight = nil
state.chatDetent = 0 state.chatDetent = 0
NotificationCenter.default.post(name: .islandCollapse, object: nil) NotificationCenter.default.post(name: .islandCollapse, object: "user")
}) { }) {
Image(systemName: "chevron.up") Image(systemName: "chevron.up")
.font(.system(size: 13, weight: .semibold)) .font(.system(size: 13, weight: .semibold))
@@ -369,8 +369,14 @@ final class IslandWindowController: NSWindowController {
state.lastActivity = .now state.lastActivity = .now
} }
func collapse() { /// `byUser`: the ⌃ button or the toggle hotkey — folds a chat/terminal tab away too;
/// only a pending approval still keeps the island open.
func collapse(byUser: Bool = false) {
if byUser {
guard state.pendingApproval == nil else { return }
} else {
guard fsm.isHeldOpen?() != true else { return } guard fsm.isHeldOpen?() != true else { return }
}
state.isPinned = false state.isPinned = false
finishedPinTimer?.cancel() finishedPinTimer?.cancel()
// Keep the FSM in step with what is on screen (home/coucou → petit now). // Keep the FSM in step with what is on screen (home/coucou → petit now).
@@ -391,7 +397,7 @@ final class IslandWindowController: NSWindowController {
switch action { switch action {
case .toggleIsland: case .toggleIsland:
if state.mode == .expanded { if state.mode == .expanded {
collapse() collapse(byUser: true)
} else { } else {
islandPanel.makeKey() islandPanel.makeKey()
expand(to: defaultView()) expand(to: defaultView())
@@ -617,8 +623,9 @@ final class IslandWindowController: NSWindowController {
} }
// Collapse requests from views (OK button, etc.) // Collapse requests from views (OK button, etc.)
NotificationCenter.default.addObserver(forName: .islandCollapse, object: nil, queue: .main) { [weak self] _ in NotificationCenter.default.addObserver(forName: .islandCollapse, object: nil, queue: .main) { [weak self] note in
self?.collapse() let byUser = (note.object as? String) == "user"
MainActor.assumeIsolated { self?.collapse(byUser: byUser) }
} }
// Wardrobe open/close from desktop Mochi right-click (does NOT post .hookExpand) // Wardrobe open/close from desktop Mochi right-click (does NOT post .hookExpand)