]> git.lyx.org Git - lyx.git/blob - src/support/AppleSupport.m
#11756 Respect system preferences for tabbing on Mac
[lyx.git] / src / support / AppleSupport.m
1 /**
2  * \file AppleSupport.m
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Stephan Witt
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #import <Cocoa/Cocoa.h>
12 #include "AppleSupport.h"
13
14
15 void appleCleanupEditMenu() {
16
17         // Remove (disable) the "Start Dictation..." and "Emoji & Symbols" menu items
18         // from the "Edit" menu
19
20         [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledDictationMenuItem"];
21         [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledCharacterPaletteMenuItem"];
22 }
23
24
25 void appleCleanupViewMenu() {
26
27         // Remove the "Show Tab Bar" menu item from the "View" menu, if supported
28         // See the Apple developer release notes:
29         // What should an application which already has support for tabbing do?
30         // - The application should explicitly opt-out of automatic window tabbing...
31         // It should respect the userTabbingPreference... see below
32         // https://developer.apple.com/library/archive/releasenotes/AppKit/RN-AppKitOlderNotes/index.html
33         if ([NSWindow respondsToSelector:@selector(allowsAutomaticWindowTabbing)])
34                 [NSWindow setAllowsAutomaticWindowTabbing:NO];
35
36         // Remove the "Enter Full Screen" menu item from the "View" menu
37         [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
38 }
39
40
41 bool appleUserTabbingPreferenceAlways() {
42         return [NSWindow respondsToSelector:@selector(userTabbingPreference)] &&
43                 [NSWindow userTabbingPreference] == NSWindowUserTabbingPreferenceAlways;
44 }