Skip to content

Commit db09894

Browse files
MagicalTuxclaude
andcommitted
revert: remove non-functional tab context menu code
The native macOS tab bar context menu is controlled by AppKit internals and cannot be customized via setContextMenu:/setMenu: on NSWindowTab or menuForEvent: on NSWindow. Remove the failed attempts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 310011e commit db09894

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

crates/cterm-cocoa/src/window.rs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ pub struct CtermWindowIvars {
3434
quick_open: RefCell<Option<Retained<QuickOpenOverlay>>>,
3535
/// Whether this window has an active bell notification
3636
has_active_bell: std::cell::Cell<bool>,
37-
/// Whether the tab context menu has been set up
38-
tab_menu_set: std::cell::Cell<bool>,
3937
}
4038

4139
define_class!(
@@ -73,9 +71,6 @@ define_class!(
7371
if !self.apply_pending_tab_color() {
7472
self.schedule_tab_color_retry();
7573
}
76-
77-
// Set up the right-click context menu on the native tab
78-
self.setup_tab_context_menu();
7974
}
8075

8176
#[unsafe(method(windowDidResignKey:))]
@@ -193,8 +188,6 @@ define_class!(
193188
// Still not ready, try again
194189
self.schedule_tab_color_retry();
195190
}
196-
// Also set up context menu if tab is now available
197-
self.setup_tab_context_menu();
198191
}
199192

200193
/// Set tab color via color picker dialog
@@ -303,7 +296,6 @@ impl CtermWindow {
303296
pending_tab_color: RefCell::new(pending_tab_color),
304297
quick_open: RefCell::new(None),
305298
has_active_bell: std::cell::Cell::new(false),
306-
tab_menu_set: std::cell::Cell::new(false),
307299
});
308300

309301
let this: Retained<Self> = unsafe {
@@ -571,44 +563,6 @@ impl CtermWindow {
571563
this
572564
}
573565

574-
/// Set up the context menu on the native macOS tab (right-click menu)
575-
fn setup_tab_context_menu(&self) {
576-
if self.ivars().tab_menu_set.get() {
577-
return;
578-
}
579-
580-
unsafe {
581-
let tab: *mut objc2::runtime::AnyObject = msg_send![self, tab];
582-
if tab.is_null() {
583-
return;
584-
}
585-
586-
let mtm = MainThreadMarker::from(self);
587-
let menu = NSMenu::new(mtm);
588-
589-
// Set Title...
590-
let title_item = NSMenuItem::initWithTitle_action_keyEquivalent(
591-
mtm.alloc(),
592-
&NSString::from_str("Set Title..."),
593-
Some(objc2::sel!(setTerminalTitle:)),
594-
&NSString::from_str(""),
595-
);
596-
menu.addItem(&title_item);
597-
598-
// Set Tab Color...
599-
let color_item = NSMenuItem::initWithTitle_action_keyEquivalent(
600-
mtm.alloc(),
601-
&NSString::from_str("Set Tab Color..."),
602-
Some(objc2::sel!(setTabColor:)),
603-
&NSString::from_str(""),
604-
);
605-
menu.addItem(&color_item);
606-
607-
let _: () = msg_send![tab, setContextMenu: &*menu];
608-
self.ivars().tab_menu_set.set(true);
609-
}
610-
}
611-
612566
/// Get the current tab color
613567
pub fn tab_color(&self) -> Option<String> {
614568
self.ivars().pending_tab_color.borrow().clone()

0 commit comments

Comments
 (0)