summaryrefslogtreecommitdiffstats
path: root/ui/macosx/cocoa_bridge.mm
diff options
context:
space:
mode:
Diffstat (limited to 'ui/macosx/cocoa_bridge.mm')
-rw-r--r--ui/macosx/cocoa_bridge.mm35
1 files changed, 35 insertions, 0 deletions
diff --git a/ui/macosx/cocoa_bridge.mm b/ui/macosx/cocoa_bridge.mm
new file mode 100644
index 00000000..909bf223
--- /dev/null
+++ b/ui/macosx/cocoa_bridge.mm
@@ -0,0 +1,35 @@
+/* cocoa_bridge.mm
+ *
+ * This code was taken directly from:
+ * https://forum.qt.io/topic/82609/remove-native-mac-menu-items-such-as-show-tab-bar
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include <ui/macosx/cocoa_bridge.h>
+#include <ui/macosx/macos_compat.h>
+
+#import <Cocoa/Cocoa.h>
+
+void CocoaBridge::cleanOSGeneratedMenuItems()
+{
+#ifdef AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
+ // Remove (don't allow) the "Show Tab Bar" menu item from the "View" menu, if
+ // supported
+
+ if ([NSWindow respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:)])
+ [NSWindow setAllowsAutomaticWindowTabbing: NO];
+#endif
+
+ [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
+
+ // Remove (disable) the "Start Dictation..." and "Emoji & Symbols" menu items
+ // from the "Edit" menu
+
+ [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledDictationMenuItem"];
+ [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSDisabledCharacterPaletteMenuItem"];
+}