Skip to content

Commit 03f9a75

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/issue-62
# Conflicts: # Macterm/App/AppCommand.swift
2 parents fc1d17b + 9915f65 commit 03f9a75

38 files changed

Lines changed: 2714 additions & 156 deletions

.gitignore

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,18 @@ xcuserdata/
44
DerivedData/
55
.netrc
66
GhosttyKit.xcframework
7-
GhosttyKit/ghostty.h
8-
/ghostty
97

108
# Ghostty resources downloaded by setup.sh from the thdxg/ghostty release,
11-
# mirroring a real Ghostty.app layout: ghostty/{themes,shell-integration} plus
12-
# a sibling terminfo/. Macterm ships them verbatim so users configure themes
13-
# via their Ghostty config — none are committed here. (The bare themes/ and
14-
# shell-integration/ lines cover the older flat layout in case it lingers.)
15-
/Macterm/Resources/ghostty/
16-
/Macterm/Resources/terminfo/
17-
/Macterm/Resources/shell-integration/
18-
/Macterm/Resources/themes/
9+
# mirroring a real Ghostty.app layout (ghostty/{themes,shell-integration} plus a
10+
# sibling terminfo/). The directory is committed (via .gitkeep) so it exists on
11+
# clone, but its downloaded contents are never committed — ignore everything
12+
# inside except the .gitkeep.
13+
/Macterm/Resources/*
14+
!/Macterm/Resources/.gitkeep
1915
/build
2016
.agents/
2117
.claude/
18+
.codegraph/
2219
*.dmg
2320
appcast*.xml
2421
macterm_run.log

CLAUDE.md

Lines changed: 45 additions & 13 deletions
Large diffs are not rendered by default.

Macterm/App/AppCommand.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ enum AppCommand: String, CaseIterable, Identifiable {
3232
case renameProject
3333
case removeProject
3434
case replaceProjectPathWithCurrentDir
35+
case applyLayout
36+
case saveLayout
3537
case nextProject
3638
case previousProject
3739
// Window
@@ -67,6 +69,8 @@ enum AppCommand: String, CaseIterable, Identifiable {
6769
case .renameProject: "Rename current project"
6870
case .removeProject: "Remove current project"
6971
case .replaceProjectPathWithCurrentDir: "Replace project path with current directory"
72+
case .applyLayout: "Apply layout"
73+
case .saveLayout: "Save layout"
7074
case .nextProject: "Next project"
7175
case .previousProject: "Previous project"
7276
case .toggleSidebar: "Toggle sidebar"
@@ -101,6 +105,8 @@ enum AppCommand: String, CaseIterable, Identifiable {
101105
.renameProject,
102106
.removeProject,
103107
.replaceProjectPathWithCurrentDir,
108+
.applyLayout,
109+
.saveLayout,
104110
.nextProject,
105111
.previousProject: .projects
106112
case .toggleSidebar,
@@ -143,7 +149,9 @@ enum AppCommand: String, CaseIterable, Identifiable {
143149
case .renameTab: .renameTab
144150
case .renameProject: .renameProject
145151
case .removeProject,
146-
.replaceProjectPathWithCurrentDir: nil
152+
.replaceProjectPathWithCurrentDir,
153+
.applyLayout,
154+
.saveLayout: nil
147155
}
148156
}
149157

Macterm/App/AppCommandActions.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,20 @@ extension AppCommand {
109109
current?.path != pwd
110110
else { return nil }
111111
return { ctx.appState.replaceProjectPathWithCurrentDir(projectStore: ctx.projectStore) }
112+
case .applyLayout:
113+
guard let projectID, let current else { return nil }
114+
return {
115+
if let error = ctx.appState.applyLayout(projectID: projectID, projectName: current.name, projectRoot: current.path) {
116+
presentLayoutError(error, verb: "apply")
117+
}
118+
}
119+
case .saveLayout:
120+
guard let projectID, let current else { return nil }
121+
return {
122+
if let error = ctx.appState.saveLayout(projectID: projectID, projectName: current.name, projectRoot: current.path) {
123+
presentLayoutError(error, verb: "save")
124+
}
125+
}
112126
case .nextProject:
113127
return { ctx.appState.selectNextProject(projects: ctx.projectStore.projects) }
114128
case .previousProject:
@@ -126,3 +140,14 @@ extension AppCommand {
126140
}
127141
}
128142
}
143+
144+
/// Surface a layout apply/save failure (most commonly a missing or unparseable
145+
/// `.macterm/layout.yaml`) as a simple modal alert.
146+
@MainActor
147+
private func presentLayoutError(_ error: Error, verb: String) {
148+
let alert = NSAlert()
149+
alert.alertStyle = .warning
150+
alert.messageText = "Couldn't \(verb) layout"
151+
alert.informativeText = error.localizedDescription
152+
alert.runModal()
153+
}

0 commit comments

Comments
 (0)