parent
e313cdac14
commit
899152db49
|
@ -102,6 +102,7 @@
|
|||
- (void)windowDidExitFullScreen:(NSNotification *)notification;
|
||||
|
||||
- (IBAction)toggleMiniMode:(id)sender;
|
||||
- (IBAction)toggleToolbarStyle:(id)sender;
|
||||
|
||||
@property BOOL miniMode;
|
||||
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
#import <MASShortcut/Shortcut.h>
|
||||
#import "Shortcuts.h"
|
||||
|
||||
@implementation AppController
|
||||
@implementation AppController {
|
||||
BOOL _isFullToolbarStyle;
|
||||
}
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
|
@ -175,6 +177,8 @@
|
|||
// Restore mini mode
|
||||
[self setMiniMode:[[NSUserDefaults standardUserDefaults] boolForKey:@"miniMode"]];
|
||||
|
||||
[self setToolbarStyle:[[NSUserDefaults standardUserDefaults] boolForKey:@"toolbarStyleFull"]];
|
||||
|
||||
// We need file tree view to restore its state here
|
||||
// so attempt to access file tree view controller's root view
|
||||
// to force it to read nib and create file tree view for us
|
||||
|
@ -549,4 +553,28 @@
|
|||
[windowToShow makeKeyAndOrderFront:self];
|
||||
}
|
||||
|
||||
- (IBAction)toggleToolbarStyle:(id)sender {
|
||||
[self setToolbarStyle:!_isFullToolbarStyle];
|
||||
}
|
||||
|
||||
- (void)setToolbarStyle:(BOOL)full {
|
||||
_isFullToolbarStyle = full;
|
||||
[[NSUserDefaults standardUserDefaults] setBool:full forKey:@"toolbarStyleFull"];
|
||||
DLog("Changed toolbar style: %@", (full ? @"full" : @"compact"));
|
||||
|
||||
if (@available(macOS 11.0, *)) {
|
||||
NSWindowToolbarStyle style =
|
||||
full ? NSWindowToolbarStyleExpanded : NSWindowToolbarStyleUnifiedCompact;
|
||||
mainWindow.toolbarStyle = style;
|
||||
miniWindow.toolbarStyle = style;
|
||||
}
|
||||
|
||||
NSWindowTitleVisibility visibility = full ? NSWindowTitleVisible : NSWindowTitleHidden;
|
||||
mainWindow.titleVisibility = visibility;
|
||||
miniWindow.titleVisibility = visibility;
|
||||
|
||||
// Fix empty area after changing toolbar style in mini window as it has no content view
|
||||
[miniWindow setContentSize:NSMakeSize(miniWindow.frame.size.width, 0)];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -978,6 +978,12 @@
|
|||
<action selector="toggleVertical:" target="2172" id="2176"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Toggle Toolbar Style" id="vBH-Mr-XWi">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleToolbarStyle:" target="226" id="EYr-kR-yZK"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="2155"/>
|
||||
<menuItem title="Customize Toolbar..." id="1856">
|
||||
<connections>
|
||||
|
|
Loading…
Reference in New Issue