Skip to content

Commit

Permalink
Change activation policy in notification manager
Browse files Browse the repository at this point in the history
  • Loading branch information
russellhancox committed Jul 16, 2024
1 parent 08965cf commit fdfc329
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 30 deletions.
12 changes: 0 additions & 12 deletions Source/gui/SNTBinaryMessageWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,6 @@ - (void)loadWindow {
}
}

- (void)showWindow:(id)sender {
// Add app to Cmd+Tab and Dock.
NSApp.activationPolicy = NSApplicationActivationPolicyRegular;
[super showWindow:sender];
}

- (void)windowWillClose:(NSNotification *)notification {
// Remove app from Cmd+Tab and Dock.
NSApp.activationPolicy = NSApplicationActivationPolicyAccessory;
[super windowWillClose:notification];
}

- (NSString *)messageHash {
return self.event.fileSHA256;
}
Expand Down
9 changes: 0 additions & 9 deletions Source/gui/SNTDeviceMessageWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,9 @@ - (void)showWindow:(id)sender {
customMsg:self.attributedCustomMessage];
self.window.delegate = self;

// Add app to Cmd+Tab and Dock.
NSApp.activationPolicy = NSApplicationActivationPolicyRegular;

[super showWindow:sender];
}

- (void)windowWillClose:(NSNotification *)notification {
// Remove app from Cmd+Tab and Dock.
NSApp.activationPolicy = NSApplicationActivationPolicyAccessory;
[super windowWillClose:notification];
}

- (NSAttributedString *)attributedCustomMessage {
return [SNTBlockMessage formatMessage:self.customMessage];
}
Expand Down
9 changes: 0 additions & 9 deletions Source/gui/SNTFileAccessMessageWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,9 @@ - (void)showWindow:(id)sender {

self.window.delegate = self;

// Make sure app doesn't appear in Cmd+Tab or Dock.
NSApp.activationPolicy = NSApplicationActivationPolicyAccessory;

[super showWindow:sender];
}

- (void)windowWillClose:(NSNotification *)notification {
// Remove app from Cmd+Tab and Dock.
NSApp.activationPolicy = NSApplicationActivationPolicyAccessory;
[super windowWillClose:notification];
}

- (NSAttributedString *)attributedCustomMessage {
return [SNTBlockMessage attributedBlockMessageForFileAccessEvent:self.event
customMessage:self.customMessage];
Expand Down
4 changes: 4 additions & 0 deletions Source/gui/SNTNotificationManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ - (void)windowDidCloseSilenceHash:(NSString *)hash {
[bc resume];
[[bc remoteObjectProxy] spindown];
[bc invalidate];
// Remove app from Cmd+Tab and Dock.
NSApp.activationPolicy = NSApplicationActivationPolicyAccessory;
[NSApp hide:self];
}
}
Expand Down Expand Up @@ -125,6 +127,8 @@ - (void)queueMessage:(SNTMessageWindowController *)pendingMsg {
[self.pendingNotifications addObject:pendingMsg];

if (!self.currentWindowController) {
// Add app to Cmd+Tab and Dock.
NSApp.activationPolicy = NSApplicationActivationPolicyRegular;
[self showQueuedWindow];
}
}
Expand Down

0 comments on commit fdfc329

Please sign in to comment.