Spawn alert box on new tab if decorations disabled

Stray spaces

Fix check for windowDecoration
This commit is contained in:
SoraTenshi
2023-09-15 11:16:18 +02:00
committed by Mitchell Hashimoto
parent 2b380ad37e
commit 833be445ba
2 changed files with 11 additions and 1 deletions

View File

@ -15,7 +15,7 @@ class FocusedSurfaceWrapper {
// such as non-native fullscreen.
class PrimaryWindow: NSWindow {
var focusedSurfaceWrapper: FocusedSurfaceWrapper = FocusedSurfaceWrapper()
static func create(ghostty: Ghostty.AppState, appDelegate: AppDelegate, baseConfig: ghostty_surface_config_s? = nil) -> PrimaryWindow {
let window = PrimaryWindow(
contentRect: NSRect(x: 0, y: 0, width: 800, height: 600),

View File

@ -385,6 +385,16 @@ extension Ghostty {
static func newTab(_ userdata: UnsafeMutableRawPointer?, config: ghostty_surface_config_s) {
guard let surface = self.surfaceUserdata(from: userdata) else { return }
guard self.appState(fromSurface: userdata)?.windowDecorations else {
let alert = NSAlert()
alert.messageText = "Tabs are disabled"
alert.informativeText = "Enable window decorations to use tabs"
alert.addButton(withTitle: "OK")
alert.alertStyle = .warning
_ = alert.runModal()
return
}
NotificationCenter.default.post(
name: Notification.ghosttyNewTab,
object: surface,