Permalink
Browse files

Remember blacklisted applications and their windows.

  • Loading branch information...
1 parent a6d498b commit 819d23565b7d5dbe490bea8f5ad87f2b38604791 @eczarny committed Oct 19, 2012
Showing with 11 additions and 1 deletion.
  1. +4 −0 SpectacleConstants.h
  2. +7 −1 SpectacleWindowPositionManager.m
View
@@ -46,3 +46,7 @@
#define SpectacleStatusItemEnabledPreference @"StatusItemEnabled"
#define SpectacleBackgroundAlertSuppressedPreference @"BackgroundAlertSuppressed"
+
+#pragma mark -
+
+#define SpectacleApplicationBlacklistPreference @"ApplicationBlacklist"
@@ -85,9 +85,11 @@ @implementation SpectacleWindowPositionManager
- (id)init {
if ((self = [super init])) {
+ NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
+
myUndoHistory = [[NSMutableDictionary dictionary] retain];
myRedoHistory = [[NSMutableDictionary dictionary] retain];
- myBlacklistedWindowRects = [[NSMutableSet set] retain];
+ myBlacklistedWindowRects = [[NSMutableSet setWithArray: [userDefaults arrayForKey: SpectacleApplicationBlacklistPreference]] retain];
}
return self;
@@ -263,10 +265,14 @@ - (void)moveWindowRect: (CGRect)windowRect frameOfScreen: (CGRect)frameOfScreen
CGRect movedWindowRect = [self rectOfWindowWithAccessibilityElement: [self frontMostWindowElement]];
if (MovingToThirdOfDisplay(action) && !CGRectEqualToRect(movedWindowRect, windowRect)) {
+ NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
+
NSBeep();
[myBlacklistedWindowRects addObject: blacklistedWindowRect];
+ [userDefaults setObject: [myBlacklistedWindowRects allObjects] forKey: SpectacleApplicationBlacklistPreference];
+
[self moveWindowRect: previousWindowRect frontMostWindowElement: frontMostWindowElement];
return;

0 comments on commit 819d235

Please sign in to comment.