mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-06-28 10:18:42 +03:00
Spawn alert box on new tab if decorations disabled
Stray spaces Fix check for windowDecoration
This commit is contained in:

committed by
Mitchell Hashimoto

parent
2b380ad37e
commit
833be445ba
@ -15,7 +15,7 @@ class FocusedSurfaceWrapper {
|
|||||||
// such as non-native fullscreen.
|
// such as non-native fullscreen.
|
||||||
class PrimaryWindow: NSWindow {
|
class PrimaryWindow: NSWindow {
|
||||||
var focusedSurfaceWrapper: FocusedSurfaceWrapper = FocusedSurfaceWrapper()
|
var focusedSurfaceWrapper: FocusedSurfaceWrapper = FocusedSurfaceWrapper()
|
||||||
|
|
||||||
static func create(ghostty: Ghostty.AppState, appDelegate: AppDelegate, baseConfig: ghostty_surface_config_s? = nil) -> PrimaryWindow {
|
static func create(ghostty: Ghostty.AppState, appDelegate: AppDelegate, baseConfig: ghostty_surface_config_s? = nil) -> PrimaryWindow {
|
||||||
let window = PrimaryWindow(
|
let window = PrimaryWindow(
|
||||||
contentRect: NSRect(x: 0, y: 0, width: 800, height: 600),
|
contentRect: NSRect(x: 0, y: 0, width: 800, height: 600),
|
||||||
|
@ -385,6 +385,16 @@ extension Ghostty {
|
|||||||
static func newTab(_ userdata: UnsafeMutableRawPointer?, config: ghostty_surface_config_s) {
|
static func newTab(_ userdata: UnsafeMutableRawPointer?, config: ghostty_surface_config_s) {
|
||||||
guard let surface = self.surfaceUserdata(from: userdata) else { return }
|
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(
|
NotificationCenter.default.post(
|
||||||
name: Notification.ghosttyNewTab,
|
name: Notification.ghosttyNewTab,
|
||||||
object: surface,
|
object: surface,
|
||||||
|
Reference in New Issue
Block a user