3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
10 #include <ui/macosx/cocoa_bridge.h>
11 #include <ui/macosx/macos_compat.h>
13 #import <Cocoa/Cocoa.h>
15 void CocoaBridge::cleanOSGeneratedMenuItems()
17 // This code was taken directly from:
18 // https://forum.qt.io/topic/82609/remove-native-mac-menu-items-such-as-show-tab-bar
20 #ifdef AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
21 // Remove (don't allow) the "Show Tab Bar" menu item from the "View" menu, if
24 if ([NSWindow respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:)])
25 [NSWindow setAllowsAutomaticWindowTabbing: NO];
28 [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
30 // Remove (disable) the "Start Dictation..." and "Emoji & Symbols" menu items
31 // from the "Edit" menu
33 [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledDictationMenuItem"];
34 [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSDisabledCharacterPaletteMenuItem"];
37 void CocoaBridge::showInFinder(char const *file_path)
39 NSURL *url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:file_path]];
41 [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:@[url]];