Skip to content

Commit b69bf24

Browse files
committed
Conditionally add Change Title menu item based on window decorations
1 parent 5c9d929 commit b69bf24

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

macos/Sources/Ghostty/SurfaceView_AppKit.swift

+14-2
Original file line numberDiff line numberDiff line change
@@ -1171,8 +1171,15 @@ extension Ghostty {
11711171
menu.addItem(.separator())
11721172
menu.addItem(withTitle: "Reset Terminal", action: #selector(resetTerminal(_:)), keyEquivalent: "")
11731173
menu.addItem(withTitle: "Toggle Terminal Inspector", action: #selector(toggleTerminalInspector(_:)), keyEquivalent: "")
1174-
menu.addItem(.separator())
1175-
menu.addItem(withTitle: "Change Title...", action: #selector(changeTitle(_:)), keyEquivalent: "")
1174+
1175+
// Only show Change Title menu item if we have a title bar
1176+
if let window = self.window,
1177+
!window.styleMask.contains(.fullScreen),
1178+
let appDelegate = NSApplication.shared.delegate as? AppDelegate,
1179+
appDelegate.ghostty.config.windowDecorations {
1180+
menu.addItem(.separator())
1181+
menu.addItem(withTitle: "Change Title...", action: #selector(changeTitle(_:)), keyEquivalent: "")
1182+
}
11761183

11771184
return menu
11781185
}
@@ -1548,6 +1555,11 @@ extension Ghostty.SurfaceView: NSMenuItemValidation {
15481555
guard let str = pb.getOpinionatedStringContents() else { return false }
15491556
return !str.isEmpty
15501557

1558+
case #selector(changeTitle):
1559+
guard let window = self.window,
1560+
let appDelegate = NSApplication.shared.delegate as? AppDelegate else { return false }
1561+
return !window.styleMask.contains(.fullScreen) && appDelegate.ghostty.config.windowDecorations
1562+
15511563
default:
15521564
return true
15531565
}

0 commit comments

Comments
 (0)