mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-31 03:13:40 +00:00
macos: set env var for app bundle to detect app launch vs CLI
This commit is contained in:
@@ -2,7 +2,6 @@ import AppKit
|
||||
import OSLog
|
||||
import GhosttyKit
|
||||
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, ObservableObject, NSApplicationDelegate, GhosttyAppStateDelegate {
|
||||
// The application logger. We should probably move this at some point to a dedicated
|
||||
// class/struct but for now it lives here! 🤷♂️
|
||||
|
||||
12
macos/Sources/main.swift
Normal file
12
macos/Sources/main.swift
Normal file
@@ -0,0 +1,12 @@
|
||||
import AppKit
|
||||
import Cocoa
|
||||
|
||||
// We put the GHOSTTY_MAC_APP env var into the Info.plist to detect
|
||||
// whether we launch from the app or not. A user can fake this if
|
||||
// they want but they're doing so at their own detriment...
|
||||
let process = ProcessInfo.processInfo
|
||||
if (process.environment["GHOSTTY_MAC_APP"] == "") {
|
||||
AppDelegate.logger.warning("NOT IN THE MAC APP")
|
||||
}
|
||||
|
||||
_ = NSApplicationMain(CommandLine.argc, CommandLine.unsafeArgv)
|
||||
Reference in New Issue
Block a user