Skip to content
This repository has been archived by the owner on Mar 23, 2019. It is now read-only.

Commit

Permalink
double-checks inactive toggle before blurring
Browse files Browse the repository at this point in the history
  • Loading branch information
insanj committed Feb 4, 2014
1 parent 384e104 commit 839a250
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions SwitcherBlur.xm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/*********************** Global Functions **********************/

static NSMutableArray *switcherblur_DisabledApps; // @"All" means all are disabled, nil means everything's enabled
static BOOL switcherblur_blurIfInactive;
static NSInteger switcherblur_blurIfInactive;

static void switcherBlur_reloadSettings(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo){
NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[NSHomeDirectory() stringByAppendingPathComponent:@"/Library/Preferences/com.insanj.switcherblur.plist"]];
Expand All @@ -45,7 +45,7 @@ static void switcherBlur_reloadSettings(CFNotificationCenterRef center, void *ob
if(switcherblur_DisabledApps.count == 0)
switcherblur_DisabledApps = nil;

switcherblur_blurIfInactive = [settings objectForKey:@"running"] && [[settings objectForKey:@"running"] boolValue];
switcherblur_blurIfInactive = ([settings objectForKey:@"running"] && [[settings objectForKey:@"running"] boolValue]) + 1;
}
}

Expand All @@ -54,8 +54,13 @@ static void switcherBlur_reloadSettings(CFNotificationCenterRef center, void *ob
%hook SBAppSliderSnapshotView

+(id)appSliderSnapshotViewForApplication:(SBApplication*)application orientation:(int)orientation loadAsync:(BOOL)async withQueue:(id)queue statusBarCache:(id)cache{
if(switcherblur_blurIfInactive == 0){
NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[NSHomeDirectory() stringByAppendingPathComponent:@"/Library/Preferences/com.insanj.switcherblur.plist"]];
switcherblur_blurIfInactive = ([settings objectForKey:@"running"] && [[settings objectForKey:@"running"] boolValue]) + 1;
}

if(!switcherblur_DisabledApps || ![switcherblur_DisabledApps[0] isEqualToString:@"All"]){
if(![switcherblur_DisabledApps containsObject:[application bundleIdentifier]] && !(switcherblur_blurIfInactive && [application isRunning])){
if(![switcherblur_DisabledApps containsObject:[application bundleIdentifier]] && !((switcherblur_blurIfInactive == 2) && [application isRunning])){
NSLog(@"[SwitcherBlur]: Blurring application-specific snapshotImage %@", %orig());

UIImageView *snapshot = (UIImageView *) %orig();
Expand Down

0 comments on commit 839a250

Please sign in to comment.