Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

fix(desktop): lead the File menu with the harness actions (#215)

Dee63566f24d50c
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index f1ed1684f..81ee77a64 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -270,7 +270,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
item.representedObject = action
item.identifier = NSUserInterfaceItemIdentifier(HarnessKeymapMenu.actionPrefix + action)
let symbols = [
- "new": "plus.square", "newAgent": "plus", "addAgent": "plus", "newTerminal": "terminal",
+ "new": "plus.square", "newAgent": "plus", "addAgent": "arrow.up.right.square", "newTerminal": "terminal",
"cloneAgent": "plus.square.on.square",
"renameActive": "pencil", "closeActive": "xmark",
"splitRight": "rectangle.split.2x1", "splitDown": "rectangle.split.1x2",
@@ -289,19 +289,20 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
}
if let file = main.item(withTitle: "File") { main.removeItem(file) }
let file = NSMenu(title: "File")
- add(file, "New Tab", "t", "new")
- add(file, "Open Harness…", "o", "addAgent")
- // ⌘⇧T, as in a terminal app. It used to be Reopen Last Closed (History menu), which keeps its
- // row and loses its default chord — the Dart keymap (`swarm.reopen`) is where both are decided,
- // and applyMenuKeys rewrites every equivalent here from it.
- add(file, "New Terminal", "t", "newTerminal", [.command, .shift])
+ // Three groups, most-used first: harnesses, then tabs, then panes. Plain titles, no trailing
+ // ellipsis (owner, 2026-09-22). The Dart keymap decides every chord below — applyMenuKeys
+ // rewrites each equivalent here from it. New Terminal (⇧⌘T) stays in the keymap, off the menu.
+ add(file, "New Harness", "n", "newAgent")
+ add(file, "Open Harness", "o", "addAgent")
// ⌘⇧N: another agent like the focused pane's, fresh conversation (Dart: `agent.clone`).
add(file, "Clone Harness", "n", "cloneAgent", [.command, .shift])
- add(file, "Rename Tab…", "r", "renameActive", [.command, .shift])
+ file.addItem(.separator())
+ add(file, "New Tab", "t", "new")
+ add(file, "Rename Tab", "r", "renameActive", [.command, .shift])
add(file, "Close Tab", "w", "closeActive")
file.addItem(.separator())
- add(file, "Split Right…", "r", "splitRight")
- add(file, "Split Down…", "d", "splitDown")
+ add(file, "Split Right", "r", "splitRight")
+ add(file, "Split Down", "d", "splitDown")
add(file, "Zoom Pane", "", "zoomPane")
add(file, "Close Pane", "w", "closePane", [.command, .shift])
install(file, at: 1)
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index b4f8af563..f4a75276c 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -682,14 +682,16 @@ private extension SwarmTitlebar {
try checkTitlebar(settings.title == "Settings…" && settings.representedObject as? String == "settings", "Settings stays in the application menu")
let agent = main.item(withTitle: "File")!.submenu!
let addHarness = agent.items.first(where: { $0.representedObject as? String == "addAgent" })!
- try checkTitlebar(addHarness.title == "Open Harness…" && addHarness.keyEquivalent == "o" && addHarness.keyEquivalentModifierMask == [.command],
+ try checkTitlebar(addHarness.title == "Open Harness" && addHarness.keyEquivalent == "o" && addHarness.keyEquivalentModifierMask == [.command],
"Open Harness advertises Command-O")
- try checkTitlebar(agent.items.contains { $0.title == "New Terminal" && $0.keyEquivalent == "t" && $0.keyEquivalentModifierMask == [.command, .shift] && $0.representedObject as? String == "newTerminal" },
- "New Terminal has its Command-Shift-T menu action")
+ try checkTitlebar(!agent.items.contains { $0.representedObject as? String == "newTerminal" },
+ "New Terminal stays off the File menu; its chord lives in the keymap")
let historyMenu = main.item(withTitle: "History")!.submenu!
try checkTitlebar(agent.items.contains { $0.title == "Clone Harness" && $0.representedObject as? String == "cloneAgent" }, "Clone Harness preserves its action")
- try checkTitlebar(agent.items.map { $0.isSeparatorItem ? "separator" : ($0.representedObject as? String ?? "") } == ["new", "addAgent", "newTerminal", "cloneAgent", "renameActive", "closeActive", "separator", "splitRight", "splitDown", "zoomPane", "closePane"], "File groups tab, terminal and pane actions")
- for (action, title, key) in [("splitRight", "Split Right…", "r"), ("splitDown", "Split Down…", "d")] {
+ try checkTitlebar(agent.items.map { $0.isSeparatorItem ? "separator" : ($0.representedObject as? String ?? "") } == ["newAgent", "addAgent", "cloneAgent", "separator", "new", "renameActive", "closeActive", "separator", "splitRight", "splitDown", "zoomPane", "closePane"], "File groups harness, tab and pane actions, harnesses first")
+ try checkTitlebar(agent.items.first?.title == "New Harness" && agent.items.first?.keyEquivalent == "n" && agent.items.first?.keyEquivalentModifierMask == [.command],
+ "New Harness leads File on Command-N")
+ for (action, title, key) in [("splitRight", "Split Right", "r"), ("splitDown", "Split Down", "d")] {
let split = agent.items.first(where: { $0.representedObject as? String == action })!
try checkTitlebar(split.title == title && split.keyEquivalent == key && split.keyEquivalentModifierMask == [.command],
"\(title) advertises its directional split shortcut")
@@ -703,12 +705,12 @@ private extension SwarmTitlebar {
}
try checkTitlebar(agent.items.filter { !$0.isSeparatorItem }.allSatisfy { $0.image != nil && $0.toolTip == nil },
"Every File action has a native icon and no hover hint")
- try checkTitlebar(agent.items.contains { $0.title == "Rename Tab…" && $0.representedObject as? String == "renameActive" }, "Rename Tab preserves its command")
+ try checkTitlebar(agent.items.contains { $0.title == "Rename Tab" && $0.representedObject as? String == "renameActive" }, "Rename Tab preserves its command")
try checkTitlebar(agent.items.contains { $0.title == "Close Tab" && $0.representedObject as? String == "closeActive" }, "Close Tab preserves its command")
let commands = edit.submenu!.items.first(where: { $0.representedObject as? String == "commands" })!
try checkTitlebar(commands.keyEquivalent == "p" && commands.keyEquivalentModifierMask == [.command], "Command search keeps its native menu owner")
try checkTitlebar(edit.submenu!.items.allSatisfy { $0.representedObject as? String != "jump" }, "Edit has no Navigate action")
- try checkTitlebar(agent.items.first?.title == "New Tab" && agent.items.first?.keyEquivalent == "t", "New Tab opens the chooser with Command-T")
+ try checkTitlebar(agent.items.contains { $0.title == "New Tab" && $0.keyEquivalent == "t" && $0.representedObject as? String == "new" }, "New Tab opens the chooser with Command-T")
let reopen = historyMenu.items.first(where: { $0.representedObject as? String == "reopen" })!
actionsEnabled = true
canReopen = false