Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start with menu item hidden if it was left that way #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion SideButtonFixer/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ -(void) setMenuMode:(MenuMode)menuMode {
-(BOOL) applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag {
if (@available(macOS 10.12, *)) {
[self.statusItem setVisible:YES];
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"SBFWasHidden"];
}
return NO;
}
Expand All @@ -127,7 +128,8 @@ -(void) applicationDidFinishLaunching:(NSNotification *)aNotification {
@"SBFWasEnabled": @YES,
@"SBFMouseDown": @YES,
@"SBFDonated": @NO,
@"SBFSwapButtons": @NO
@"SBFSwapButtons": @NO,
@"SBFStartHidden": @NO
}];

// setup globals
Expand Down Expand Up @@ -231,6 +233,13 @@ -(void) applicationDidFinishLaunching:(NSNotification *)aNotification {

[self updateMenuMode];
[self refreshSettings];

if (@available(macOS 10.12, *)) {
// Start with menu item hidden if it was left that way
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"SBFWasHidden"]) {
[self.statusItem setVisible:NO];
}
}
}

-(void) updateMenuMode {
Expand Down Expand Up @@ -381,6 +390,7 @@ -(void) accessibility:(id)sender {
-(void) hideMenubarItem:(id)sender {
if (@available(macOS 10.12, *)) {
[self.statusItem setVisible:NO];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"SBFWasHidden"];
}
}

Expand Down