Merge pull request #1038 from ychin/dark-mode-selection-customization

Add dark mode customization / appearance preferences panel
This commit is contained in:
Yee Cheng Chin
2020-04-13 00:19:15 -07:00
committed by GitHub
18 changed files with 283 additions and 32 deletions
+38 -24
View File
@@ -9,18 +9,19 @@ The MacVim Graphical User Interface *macvim* *gui-macvim*
1. MacVim differences |macvim-differences|
2. Starting MacVim |macvim-start|
3. Preferences |macvim-preferences|
4. Special colors |macvim-colors|
5. Menus |macvim-menus|
6. Toolbar |macvim-toolbar|
7. Touch Bar |macvim-touchbar|
8. Dialogs |macvim-dialogs|
9. System services |macvim-services|
10. mvim:// URL handler |macvim-url-handler|
11. Keyboard shortcuts |macvim-shortcuts|
12. Trackpad gestures |macvim-gestures|
13. International |macvim-international|
14. Known bugs/missing features |macvim-todo|
15. Hints |macvim-hints|
4. MacVim appearance |macvim-appearance|
5. Special colors |macvim-colors|
6. Menus |macvim-menus|
7. Toolbar |macvim-toolbar|
8. Touch Bar |macvim-touchbar|
9. Dialogs |macvim-dialogs|
10. System services |macvim-services|
11. mvim:// URL handler |macvim-url-handler|
12. Keyboard shortcuts |macvim-shortcuts|
13. Trackpad gestures |macvim-gestures|
14. International |macvim-international|
15. Known bugs/missing features |macvim-todo|
16. Hints |macvim-hints|
Other relevant documentation:
|gui.txt| For generic items of the GUI.
@@ -259,6 +260,7 @@ KEY VALUE ~
*MMNoFontSubstitution* disable automatic font substitution [bool]
*MMNoTitleBarWindow* hide title bar [bool]
*MMTitlebarAppearsTransparent* enable a transparent titlebar [bool]
*MMAppearanceModeSelection* dark mode selection (|macvim-dark-mode|)[bool]
*MMShareFindPboard* share search text to Find Pasteboard [bool]
*MMShowAddTabButton* enable "add tab" button on tabline [bool]
*MMTabMaxWidth* maximum width of a tab [int]
@@ -301,7 +303,19 @@ shell is used, then "-l" is automatically added as an argument. To override
this behaviour set MMLoginShellArgument to "--".
==============================================================================
4. Special colors *macvim-colors*
4. MacVim appearance *macvim-appearance*
*macvim-appearance-mode* *macvim-dark-mode*
MacVim will by default use the system apperance mode (light or dark). However,
you can manually force MacVim to use either light or dark mode in the
preferences panel. A fourth option allows MacVim to respect the |'background'|
option set by Vim, which is more flexible in situations like loading a dark
color scheme while system preferences are configured to use light mode. It's
also the recommended setting when title bar is configured to be "Transparent"
(see |MMTitlebarAppearsTransparent|).
==============================================================================
5. Special colors *macvim-colors*
The colors in MacVim are defined in two dictionaries inside the "Resources"
folder of the application bundle (MacVim.app/Contents/Resources). It is
@@ -351,7 +365,7 @@ the "Appearance" pane of the System Preferences. It also changes the
highlight color when a window becomes inactive.
==============================================================================
5. Menus *macvim-menus*
6. Menus *macvim-menus*
Menus in macOS behave slightly different from other platforms. For that
reason two new commands have been added to Vim. To understand what these
@@ -474,7 +488,7 @@ _cycleWindows: Select next window (similar to <D-`>)
_cycleWindowsBackwards: Select previous window (similar to <D-S-`>)
==============================================================================
6. Toolbar *macvim-toolbar*
7. Toolbar *macvim-toolbar*
The toolbar in MacVim works just like in the other GUIs (see |gui-toolbar|),
with the addition of two separator items (see |menu-separator|). You can use
@@ -498,7 +512,7 @@ Note: Only a subset of the builtin toolbar items presently have icons. If no
icon can be found a warning triangle is displayed instead.
==============================================================================
7. Touch Bar *macvim-touchbar*
8. Touch Bar *macvim-touchbar*
Touch Bar in MacVim works similar to the toolbar (see |macvim-toolbar|). The
difference is that you use the special menu "TouchBar" instead of "ToolBar": >
@@ -536,7 +550,7 @@ ExitFullScreen |'fullscreen'| mode. To disable the button, add the
let g:macvim_default_touchbar_fullscreen=0
==============================================================================
8. Dialogs *macvim-dialogs*
9. Dialogs *macvim-dialogs*
Dialogs can be controlled with the keyboard in two ways. By default each
button in a dialog is bound to a key. The button that is highlighted by blue
@@ -555,7 +569,7 @@ select the current button. The current button is indicated with a blue
outline.
==============================================================================
9. System services *macvim-services*
10. System services *macvim-services*
MacVim supports two system services. These can be accessed from the MacVim
submenu in the Services menu or by right-clicking a selection. For services
@@ -572,7 +586,7 @@ The services respect the "Open files from applications" setting in the general
preferences.
==============================================================================
10. mvim:// URL handler *mvim://* *macvim-url-handler*
11. mvim:// URL handler *mvim://* *macvim-url-handler*
MacVim supports a custom URL handler for "mvim://" URLs. The handler is
supposed to be compatible to TextMate's URL scheme as documented at >
@@ -593,7 +607,7 @@ will open the file /etc/profile on line 20 when clicked in a web browser.
Note that url has to be a file:// url pointing to an existing local file.
==============================================================================
11. Keyboard shortcuts *macvim-shortcuts*
12. Keyboard shortcuts *macvim-shortcuts*
Most keyboard shortcuts in MacVim are bound to menu items and can be
discovered by looking through the menus (see |macvim-menus| on how to create
@@ -673,7 +687,7 @@ sometimes be slightly involved. Here are all the things you need to consider:
- A few command key mappings are set up by MacVim, see |cmd-movement|.
==============================================================================
12. Trackpad gestures *macvim-gestures*
13. Trackpad gestures *macvim-gestures*
MacVim supports trackpad swipe gestures. By default this can be used to
navigate back/forward in the help (try it!).
@@ -708,7 +722,7 @@ As another example, here is how to switch buffers by swiping left/right: >
See the section on |key-mapping| for more help on how to map keys.
==============================================================================
13. International *macvim-international*
14. International *macvim-international*
When editing non-English text it may be convenient to keep separate keyboard
layouts for normal and insert mode. This is supported via the 'imd' option on
@@ -729,7 +743,7 @@ wrong layout when going back to normal mode, then select the layout you want
to use in normal mode and type ":set imd" followed by ":set noimd".
==============================================================================
14. Known bugs/missing features *macvim-todo*
15. Known bugs/missing features *macvim-todo*
This list is by no means exhaustive, it only enumerates some of the more
prominent bugs/missing features.
@@ -760,7 +774,7 @@ This is also the best place for making feature requests as well as for asking
general questions about MacVim.
==============================================================================
15. Hints *macvim-hints*
16. Hints *macvim-hints*
In this section some general (not necessarily MacVim specific) hints are
given.
+4
View File
@@ -4957,6 +4957,7 @@ LogiPat-flags pi_logipat.txt /*LogiPat-flags*
Lua if_lua.txt /*Lua*
M motion.txt /*M*
MDI starting.txt /*MDI*
MMAppearanceModeSelection gui_mac.txt /*MMAppearanceModeSelection*
MMCellWidthMultiplier gui_mac.txt /*MMCellWidthMultiplier*
MMDialogsTrackPwd gui_mac.txt /*MMDialogsTrackPwd*
MMDisableLaunchAnimation gui_mac.txt /*MMDisableLaunchAnimation*
@@ -7728,12 +7729,15 @@ mac-vimfile os_mac.txt /*mac-vimfile*
macintosh os_mac.txt /*macintosh*
macro map.txt /*macro*
macvim gui_mac.txt /*macvim*
macvim-appearance gui_mac.txt /*macvim-appearance*
macvim-appearance-mode gui_mac.txt /*macvim-appearance-mode*
macvim-autocommands gui_mac.txt /*macvim-autocommands*
macvim-backspace gui_mac.txt /*macvim-backspace*
macvim-clientserver remote.txt /*macvim-clientserver*
macvim-colors gui_mac.txt /*macvim-colors*
macvim-colorscheme gui_mac.txt /*macvim-colorscheme*
macvim-commands gui_mac.txt /*macvim-commands*
macvim-dark-mode gui_mac.txt /*macvim-dark-mode*
macvim-default-menu gui_mac.txt /*macvim-default-menu*
macvim-delete gui_mac.txt /*macvim-delete*
macvim-dialogs gui_mac.txt /*macvim-dialogs*
+100
View File
@@ -9,6 +9,7 @@
<customObject id="-2" userLabel="File's Owner" customClass="MMPreferenceController">
<connections>
<outlet property="advancedPreferences" destination="620" id="632"/>
<outlet property="appearancePreferences" destination="hr4-G4-3ZG" id="G54-DD-ACh"/>
<outlet property="autoInstallUpdateButton" destination="UYM-W0-Kgl" id="cX5-tk-9WJ"/>
<outlet property="generalPreferences" destination="115" id="143"/>
<outlet property="layoutPopUpButton" destination="427" id="596"/>
@@ -225,6 +226,105 @@
</subviews>
<point key="canvasLocation" x="137.5" y="382"/>
</customView>
<customView id="hr4-G4-3ZG" userLabel="Appearance">
<rect key="frame" x="0.0" y="0.0" width="483" height="224"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fw0-VK-Nbz" userLabel="Dark mode selection">
<rect key="frame" x="19" y="46" width="433" height="156"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="T40-Os-PUf" userLabel="Dark mode selection">
<rect key="frame" x="-2" y="139" width="187" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Dark mode selection:" id="rgk-9z-Mrz">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<matrix verticalHuggingPriority="750" fixedFrame="YES" allowsEmptySelection="NO" autosizesCells="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Szz-4K-Xkl">
<rect key="frame" x="190" y="78" width="171" height="78"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
<size key="cellSize" width="171" height="18"/>
<size key="intercellSpacing" width="4" height="2"/>
<buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" inset="2" id="ai1-QM-Nz6">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<cells>
<column>
<buttonCell type="radio" title="Automatic" imagePosition="left" alignment="left" state="on" inset="2" id="iww-SB-HvM">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<buttonCell type="radio" title="Light mode" imagePosition="left" alignment="left" tag="1" inset="2" id="BYl-Vr-tMv">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<buttonCell type="radio" title="Dark mode" imagePosition="left" alignment="left" tag="2" inset="2" id="FdX-A8-mBi">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<buttonCell type="radio" title="Use 'background' option" imagePosition="left" alignment="left" tag="3" inset="2" id="Gte-4q-PYS">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</column>
</cells>
<connections>
<action selector="appearanceChanged:" target="-2" id="hBK-fa-8vS"/>
<binding destination="58" name="selectedTag" keyPath="values.MMAppearanceModeSelection" id="egk-8m-OAE"/>
<outlet property="delegate" destination="58" id="Sob-YR-Fmp"/>
</connections>
</matrix>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1Lk-MW-O2L">
<rect key="frame" x="188" y="0.0" width="243" height="70"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" id="tgh-S7-3or">
<font key="font" metaFont="smallSystem"/>
<string key="title">Selects when MacVim will apply dark mode. "Automatic" would choose based on the system settings, while "Use 'background' option" will base it on Vim's 'background' option.</string>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7af-iK-4r7" userLabel="Titlebar appearance">
<rect key="frame" x="19" y="20" width="433" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7ie-0J-0Zr" userLabel="Auto-install updates">
<rect key="frame" x="189" y="-1" width="244" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<string key="toolTip">MacVim will automatically download and install updates without prompting. The updated version will be used the next time MacVim starts.</string>
<buttonCell key="cell" type="check" title="Transparent" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="hzd-hj-Pth">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
<connections>
<binding destination="58" name="enabled" keyPath="values.SUCheckAtStartup" id="nYZ-8w-Dyi"/>
</connections>
</buttonCell>
<connections>
<action selector="appearanceChanged:" target="-2" id="B97-8h-FDo"/>
<binding destination="58" name="value" keyPath="values.MMTitlebarAppearsTransparent" id="pQP-eb-JXS"/>
</connections>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9Rk-gT-kVC" userLabel="Titlebar appearance">
<rect key="frame" x="-2" y="0.0" width="187" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Titlebar appearance:" id="HEH-Lo-v4I" userLabel="Titlebar appearance:">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
</customView>
</subviews>
<point key="canvasLocation" x="137.5" y="384"/>
</customView>
<customView id="620" userLabel="Advanced">
<rect key="frame" x="0.0" y="0.0" width="483" height="318"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Binary file not shown.
+2
View File
@@ -47,6 +47,8 @@
- (NSArray *)filterOpenFiles:(NSArray *)filenames;
- (BOOL)openFiles:(NSArray *)filenames withArguments:(NSDictionary *)args;
- (void)refreshAllAppearances;
- (IBAction)newWindow:(id)sender;
- (IBAction)newWindowAndActivate:(id)sender;
- (IBAction)fileOpen:(id)sender;
+9
View File
@@ -1072,6 +1072,15 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
return openOk;
}
- (void)refreshAllAppearances
{
unsigned count = [vimControllers count];
for (unsigned i = 0; i < count; ++i) {
MMVimController *vc = [vimControllers objectAtIndex:i];
[vc.windowController refreshApperanceMode];
}
}
- (IBAction)newWindow:(id)sender
{
ASLogDebug(@"Open new window");
+8
View File
@@ -1236,6 +1236,14 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
[self queueMessage:SetBlurRadiusMsgID data:data];
}
- (void)setBackground:(int)dark
{
NSMutableData *data = [NSMutableData data];
[data appendBytes:&dark length:sizeof(int)];
[self queueMessage:SetBackgroundOptionMsgID data:data];
}
- (void)updateModifiedFlag
{
int state = [self checkForModifiedBuffers];
+2 -1
View File
@@ -13,6 +13,7 @@
@interface MMPreferenceController : DBPrefsWindowController {
IBOutlet NSView *generalPreferences;
IBOutlet NSView *appearancePreferences;
IBOutlet NSView *advancedPreferences;
// General pane
@@ -25,5 +26,5 @@
- (IBAction)showWindow:(id)sender;
- (IBAction)openInCurrentWindowSelectionChanged:(id)sender;
- (IBAction)checkForUpdatesChanged:(id)sender;
- (IBAction)appearanceChanged:(id)sender;
@end
+19 -1
View File
@@ -9,6 +9,7 @@
*/
#import "MMPreferenceController.h"
#import "MMAppController.h"
#import "Miscellaneous.h"
// On Leopard, we want to use the images provided by the OS for some of the
@@ -27,6 +28,7 @@
NSString* nsImageNamePreferencesGeneral = nil;
NSString* nsImageNamePreferencesAppearance = nil;
NSString* nsImageNamePreferencesAdvanced = nil;
@@ -36,6 +38,8 @@ static void loadSymbols()
void *ptr;
if ((ptr = dlsym(RTLD_DEFAULT, "NSImageNamePreferencesGeneral")) != NULL)
nsImageNamePreferencesGeneral = *(NSString**)ptr;
if ((ptr = dlsym(RTLD_DEFAULT, "NSImageNameColorPanel")) != NULL) // Closest match for default icon for "appearance"
nsImageNamePreferencesAppearance = *(NSString**)ptr;
if ((ptr = dlsym(RTLD_DEFAULT, "NSImageNameAdvanced")) != NULL)
nsImageNamePreferencesAdvanced = *(NSString**)ptr;
}
@@ -45,6 +49,7 @@ static void loadSymbols()
- (IBAction)showWindow:(id)sender
{
[super setCrossFade:NO];
[super showWindow:sender];
#if DISABLE_SPARKLE
// If Sparkle is disabled in config, we don't want to show the preference pane
@@ -65,6 +70,14 @@ static void loadSymbols()
[self addView:generalPreferences label:@"General"];
}
if (nsImageNamePreferencesAppearance != NULL) {
[self addView:appearancePreferences
label:@"Appearance"
image:[NSImage imageNamed:nsImageNamePreferencesAppearance]];
} else {
[self addView:appearancePreferences label:@"Appearance"];
}
if (nsImageNamePreferencesAdvanced != NULL) {
[self addView:advancedPreferences
label:@"Advanced"
@@ -72,7 +85,6 @@ static void loadSymbols()
} else {
[self addView:advancedPreferences label:@"Advanced"];
}
}
@@ -112,4 +124,10 @@ static void loadSymbols()
}
}
- (IBAction)appearanceChanged:(id)sender
{
// Refresh all windows' appearance to match preference.
[[MMAppController sharedInstance] refreshAllAppearances];
}
@end
+4
View File
@@ -980,6 +980,10 @@ static BOOL isUnsafeMessage(int msgid);
if (filenames)
[[NSDocumentController sharedDocumentController]
noteNewRecentFilePaths:filenames];
} else if (SetBackgroundOptionMsgID == msgid) {
const void *bytes = [data bytes];
int dark = *((int*)bytes);
[windowController setBackgroundOption:dark];
} else if (SetBlurRadiusMsgID == msgid) {
const void *bytes = [data bytes];
int radius = *((int*)bytes);
+5
View File
@@ -45,6 +45,7 @@
NSToolbar *toolbar;
BOOL resizingDueToMove;
int blurRadius;
BOOL backgroundDark;
NSMutableArray *afterWindowPresentedQueue;
}
@@ -73,6 +74,10 @@
- (void)setScrollbarPosition:(int)pos length:(int)len identifier:(int32_t)ident;
- (void)setScrollbarThumbValue:(float)val proportion:(float)prop
identifier:(int32_t)ident;
- (void)setBackgroundOption:(int)dark;
- (void)refreshApperanceMode;
- (void)setDefaultColorsBackground:(NSColor *)back foreground:(NSColor *)fore;
- (void)setFont:(NSFont *)font;
- (void)setWideFont:(NSFont *)font;
+68 -6
View File
@@ -127,6 +127,8 @@
- (id)initWithVimController:(MMVimController *)controller
{
backgroundDark = NO;
unsigned styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable
| NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable
| NSWindowStyleMaskUnifiedTitleAndToolbar
@@ -148,12 +150,6 @@
backing:NSBackingStoreBuffered
defer:YES];
[win autorelease];
if ([[NSUserDefaults standardUserDefaults]
boolForKey:MMTitlebarAppearsTransparentKey]) {
// Transparent title bar setting
win.titlebarAppearsTransparent = true;
}
self = [super initWithWindow:win];
if (!self) return nil;
@@ -162,6 +158,8 @@
vimController = controller;
decoratedWindow = [win retain];
[self refreshApperanceMode];
// Window cascading is handled by MMAppController.
[self setShouldCascadeWindows:NO];
@@ -504,6 +502,13 @@
[decoratedWindow setRepresentedFilename:filename];
[fullScreenWindow setRepresentedFilename:filename];
if ([[NSUserDefaults standardUserDefaults] boolForKey:MMTitlebarAppearsTransparentKey]) {
// Remove the draggable file icon in the title bar for a clean look
// when we are in transparent titlebar mode.
[[decoratedWindow standardWindowButton:NSWindowDocumentIconButton] setImage: nil];
[[fullScreenWindow standardWindowButton:NSWindowDocumentIconButton] setImage: nil];
}
}
- (void)setToolbar:(NSToolbar *)theToolbar
@@ -555,6 +560,63 @@
[vimView setScrollbarThumbValue:val proportion:prop identifier:ident];
}
- (void)setBackgroundOption:(int)dark
{
backgroundDark = dark;
if ([[NSUserDefaults standardUserDefaults]
integerForKey:MMAppearanceModeSelectionKey] == MMAppearanceModeSelectionBackgroundOption)
{
[self refreshApperanceMode];
}
}
- (void)refreshApperanceMode
{
// This function calculates what apperance mode (light vs dark mode and
// titlebar settings) to use for this window, depending on what the user
// has selected as a preference.
// Transparent title bar setting
decoratedWindow.titlebarAppearsTransparent = [[NSUserDefaults standardUserDefaults]
boolForKey:MMTitlebarAppearsTransparentKey];
// Dark mode only works on 10.14+ because that's when dark mode was
// introduced.
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
if (@available(macos 10.14, *)) {
switch ([[NSUserDefaults standardUserDefaults] integerForKey:MMAppearanceModeSelectionKey])
{
case MMAppearanceModeSelectionLight:
{
decoratedWindow.appearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua];
break;
}
case MMAppearanceModeSelectionDark:
{
decoratedWindow.appearance = [NSAppearance appearanceNamed: NSAppearanceNameDarkAqua];
break;
}
case MMAppearanceModeSelectionBackgroundOption:
{
if (backgroundDark) {
decoratedWindow.appearance = [NSAppearance appearanceNamed: NSAppearanceNameDarkAqua];
} else {
decoratedWindow.appearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua];
}
break;
}
case MMAppearanceModeSelectionAuto:
default:
{
// Use the system appearance. This will also auto-switch when OS changes mode.
decoratedWindow.appearance = nil;
break;
}
}
}
#endif
}
- (void)setDefaultColorsBackground:(NSColor *)back foreground:(NSColor *)fore
{
// NOTE: This is called when the transparency changes so set the opacity
+1
View File
@@ -264,6 +264,7 @@ extern const char * const MMVimMsgIDStrings[];
MSG(AddToMRUMsgID) \
MSG(BackingPropertiesChangedMsgID) \
MSG(SetBlurRadiusMsgID) \
MSG(SetBackgroundOptionMsgID) \
MSG(NotifyAppearanceChangeMsgID) \
MSG(EnableLigaturesMsgID) \
MSG(DisableLigaturesMsgID) \
+8
View File
@@ -33,6 +33,7 @@ extern NSString *MMTranslateCtrlClickKey;
extern NSString *MMTopLeftPointKey;
extern NSString *MMOpenInCurrentWindowKey;
extern NSString *MMNoFontSubstitutionKey;
extern NSString *MMAppearanceModeSelectionKey;
extern NSString *MMNoTitleBarWindowKey;
extern NSString *MMTitlebarAppearsTransparentKey;
extern NSString *MMDisableLaunchAnimation;
@@ -82,6 +83,13 @@ enum {
MMTerminateWhenLastWindowClosed = 2,
};
// Enum for MMAppearanceModeSelectionKey
enum MMAppearanceModeSelectionEnum {
MMAppearanceModeSelectionAuto = 0,
MMAppearanceModeSelectionLight = 1,
MMAppearanceModeSelectionDark = 2,
MMAppearanceModeSelectionBackgroundOption = 3,
};
enum {
+1
View File
@@ -29,6 +29,7 @@ NSString *MMTranslateCtrlClickKey = @"MMTranslateCtrlClick";
NSString *MMTopLeftPointKey = @"MMTopLeftPoint";
NSString *MMOpenInCurrentWindowKey = @"MMOpenInCurrentWindow";
NSString *MMNoFontSubstitutionKey = @"MMNoFontSubstitution";
NSString *MMAppearanceModeSelectionKey = @"MMAppearanceModeSelection";
NSString *MMNoTitleBarWindowKey = @"MMNoTitleBarWindow";
NSString *MMTitlebarAppearsTransparentKey = @"MMTitlebarAppearsTransparent";
NSString *MMDisableLaunchAnimation = @"MMDisableLaunchAnimation";
+6
View File
@@ -2474,3 +2474,9 @@ gui_macvim_set_blur(int radius)
{
[[MMBackend sharedInstance] setBlurRadius:radius];
}
void
gui_macvim_set_background(int dark)
{
[[MMBackend sharedInstance] setBackground:dark];
}
+6
View File
@@ -897,6 +897,12 @@ did_set_string_option(
init_highlight(FALSE, FALSE);
}
#endif
#ifdef FEAT_GUI_MACVIM
// MacVim needs to know about background changes to optionally
// change the appearance mode.
gui_macvim_set_background(dark);
#endif
}
else
errmsg = e_invarg;
+2
View File
@@ -219,6 +219,8 @@ void gui_macvim_set_ligatures(int ligatures);
void gui_macvim_set_thinstrokes(int thinStrokes);
void gui_macvim_set_blur(int blur);
void gui_macvim_set_background(int dark);
int16_t odb_buffer_close(buf_T *buf);
int16_t odb_post_buffer_write(buf_T *buf);
void odb_end(void);