From 1e09a1f2e1256762780001d04e061535735e7000 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 19 Feb 2023 16:00:05 -0800 Subject: [PATCH] macos: add settings view with a coming soon to help some people --- macos/Ghostty.xcodeproj/project.pbxproj | 4 ++++ macos/Sources/GhosttyApp.swift | 4 ++++ macos/Sources/SettingsView.swift | 28 +++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 macos/Sources/SettingsView.swift diff --git a/macos/Ghostty.xcodeproj/project.pbxproj b/macos/Ghostty.xcodeproj/project.pbxproj index 71f0d767e..eea549515 100644 --- a/macos/Ghostty.xcodeproj/project.pbxproj +++ b/macos/Ghostty.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ A518502629A1A45100E4CC4F /* WindowTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = A518502529A1A45100E4CC4F /* WindowTracker.swift */; }; A535B9DA299C569B0017E2E4 /* ErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A535B9D9299C569B0017E2E4 /* ErrorView.swift */; }; A55685E029A03A9F004303CE /* AppError.swift in Sources */ = {isa = PBXBuildFile; fileRef = A55685DF29A03A9F004303CE /* AppError.swift */; }; + A59444F729A2ED5200725BBA /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A59444F629A2ED5200725BBA /* SettingsView.swift */; }; A5B30535299BEAAA0047F10C /* GhosttyApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5B30534299BEAAA0047F10C /* GhosttyApp.swift */; }; A5B30539299BEAAB0047F10C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A5B30538299BEAAB0047F10C /* Assets.xcassets */; }; A5D495A2299BEC7E00DD1313 /* GhosttyKit.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A5D495A1299BEC7E00DD1313 /* GhosttyKit.xcframework */; }; @@ -23,6 +24,7 @@ A518502529A1A45100E4CC4F /* WindowTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowTracker.swift; sourceTree = ""; }; A535B9D9299C569B0017E2E4 /* ErrorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorView.swift; sourceTree = ""; }; A55685DF29A03A9F004303CE /* AppError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppError.swift; sourceTree = ""; }; + A59444F629A2ED5200725BBA /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = ""; }; A5B30531299BEAAA0047F10C /* Ghostty.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Ghostty.app; sourceTree = BUILT_PRODUCTS_DIR; }; A5B30534299BEAAA0047F10C /* GhosttyApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GhosttyApp.swift; sourceTree = ""; }; A5B30538299BEAAB0047F10C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -49,6 +51,7 @@ A5B30534299BEAAA0047F10C /* GhosttyApp.swift */, A535B9D9299C569B0017E2E4 /* ErrorView.swift */, A55685DF29A03A9F004303CE /* AppError.swift */, + A59444F629A2ED5200725BBA /* SettingsView.swift */, A518502329A197C700E4CC4F /* TerminalView.swift */, A507573D299FF33C009D7DC7 /* TerminalSurfaceView.swift */, A518502529A1A45100E4CC4F /* WindowTracker.swift */, @@ -159,6 +162,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + A59444F729A2ED5200725BBA /* SettingsView.swift in Sources */, A518502629A1A45100E4CC4F /* WindowTracker.swift in Sources */, A518502429A197C700E4CC4F /* TerminalView.swift in Sources */, A55685E029A03A9F004303CE /* AppError.swift in Sources */, diff --git a/macos/Sources/GhosttyApp.swift b/macos/Sources/GhosttyApp.swift index 7d38157cb..42997a606 100644 --- a/macos/Sources/GhosttyApp.swift +++ b/macos/Sources/GhosttyApp.swift @@ -28,6 +28,10 @@ struct GhosttyApp: App { Button("New Tab", action: newTab).keyboardShortcut("t", modifiers: [.command]) } } + + Settings { + SettingsView() + } } // Create a new tab in the currently active window diff --git a/macos/Sources/SettingsView.swift b/macos/Sources/SettingsView.swift new file mode 100644 index 000000000..e419f9dfe --- /dev/null +++ b/macos/Sources/SettingsView.swift @@ -0,0 +1,28 @@ +import SwiftUI + +struct SettingsView: View { + var body: some View { + HStack { + Image("AppIconImage") + .resizable() + .scaledToFit() + .frame(width: 128, height: 128) + + VStack(alignment: .leading) { + Text("Coming Soon. 🚧").font(.title) + Text("You can't configure settings in the GUI yet. To modify settings, " + + "edit the file at $HOME/.config/ghostty/config and restart Ghostty.") + .multilineTextAlignment(.leading) + .lineLimit(nil) + } + } + .padding() + .frame(minWidth: 500, maxWidth: 500, minHeight: 156, maxHeight: 156) + } +} + +struct SettingsView_Previews: PreviewProvider { + static var previews: some View { + SettingsView() + } +}