From 524be0c7b5113bec3a52fe106cf6e24a6f404bb6 Mon Sep 17 00:00:00 2001 From: Norio Nomura Date: Wed, 26 Nov 2014 16:15:22 +0900 Subject: [PATCH 1/4] Change runningApplication observing codes. - Stop observing `isTerminated`. It's not happen sometime. - Use `NSKeyValueObservingOptionInitial` for simplify codes. --- SIMBL Agent/SIMBLAgent.m | 41 +++++++++------------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/SIMBL Agent/SIMBLAgent.m b/SIMBL Agent/SIMBLAgent.m index 84a4eb7..96b2a06 100644 --- a/SIMBL Agent/SIMBLAgent.m +++ b/SIMBL Agent/SIMBLAgent.m @@ -60,14 +60,9 @@ - (void) applicationDidFinishLaunching:(NSNotification*)notificaion NSWorkspace *workspace = [NSWorkspace sharedWorkspace]; [workspace addObserver:self forKeyPath:@"runningApplications" - options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld + options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld|NSKeyValueObservingOptionInitial context:NULL]; - // inject into resumed applications - for (NSRunningApplication *runningApp in [workspace runningApplications]) { - [self injectSIMBL:runningApp]; - } - // previous minus running, it should be uninject [previousInjectedSandboxBundleIdentifierSet minusSet:[NSMutableSet setWithArray:[defaults objectForKey:kInjectedSandboxBundleIdentifiers]]]; if ([previousInjectedSandboxBundleIdentifierSet count]) { @@ -90,34 +85,19 @@ - (id) eventDidFail:(const AppleEvent *)event withError:(NSError *)error; - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - if ([keyPath isEqualToString:@"isTerminated"]) { - SIMBLLogDebug(@"runningApp %@ isTerminated.", object); - [object removeObserver:self forKeyPath:keyPath]; - - [self injectContainerForApplication:(NSRunningApplication*)object enabled:NO]; - } else if ([keyPath isEqualToString:@"runningApplications"]) { - // for apps which will be terminated without called @"isFinishedLaunching" - static NSMutableSet *appsObservingFinishedLaunching = nil; - if (!appsObservingFinishedLaunching) { - appsObservingFinishedLaunching = [NSMutableSet set]; - } - + if ([keyPath isEqualToString:@"runningApplications"]) { for (NSRunningApplication *app in [change objectForKey:NSKeyValueChangeNewKey]) { - if (app.isFinishedLaunching) { - SIMBLLogDebug(@"runningApp %@ is already isFinishedLaunching", app); - [self injectSIMBL:app]; - } else { - [app addObserver:self forKeyPath:@"isFinishedLaunching" options:NSKeyValueObservingOptionNew context:NULL]; - [appsObservingFinishedLaunching addObject:app]; - } + SIMBLLogDebug(@"add runningApp %@.", app); + [app addObserver:self forKeyPath:@"isFinishedLaunching" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionInitial context:NULL]; } for (NSRunningApplication *app in [change objectForKey:NSKeyValueChangeOldKey]) { - if ([appsObservingFinishedLaunching containsObject:app]) { - [app removeObserver:self forKeyPath:@"isFinishedLaunching"]; - [appsObservingFinishedLaunching removeObject:app]; + SIMBLLogDebug(@"remove runningApp %@.", app); + [app removeObserver:self forKeyPath:@"isFinishedLaunching"]; + if ([self.runningSandboxedApplications containsObject:app]) { + [self injectContainerForApplication:app enabled:NO]; } } - } else if ([keyPath isEqualToString:@"isFinishedLaunching"]) { + } else if ([keyPath isEqualToString:@"isFinishedLaunching"] && [change[NSKeyValueChangeNewKey]boolValue]) { SIMBLLogDebug(@"runningApp %@ isFinishedLaunching.", object); [self injectSIMBL:(NSRunningApplication*)object]; } @@ -275,9 +255,6 @@ - (void)injectContainerForApplication:(NSRunningApplication*)runningApp enabled: NSString *identifier = [runningApp bundleIdentifier]; if (bEnabled) { if ([self injectContainerBundleIdentifier:identifier enabled:YES]) { - SIMBLLogDebug(@"Start observing %@'s 'isTerminated'.", identifier); - - [runningApp addObserver:self forKeyPath:@"isTerminated" options:NSKeyValueObservingOptionNew context:NULL]; [self.runningSandboxedApplications addObject:runningApp]; NSMutableSet *injectedSandboxBundleIdentifierSet = [NSMutableSet set]; From 13dfa79e582349933059353e0292189365628e76 Mon Sep 17 00:00:00 2001 From: Norio Nomura Date: Wed, 26 Nov 2014 16:38:13 +0900 Subject: [PATCH 2/4] SIMBL-0.10.10 --- SIMBL.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SIMBL.xcodeproj/project.pbxproj b/SIMBL.xcodeproj/project.pbxproj index 2ebd232..0f34a6d 100644 --- a/SIMBL.xcodeproj/project.pbxproj +++ b/SIMBL.xcodeproj/project.pbxproj @@ -374,7 +374,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; ONLY_ACTIVE_ARCH = YES; - PRODUCT_VERSION = 0.10.9; + PRODUCT_VERSION = 0.10.10; SDKROOT = macosx; }; name = Debug; @@ -394,7 +394,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; ONLY_ACTIVE_ARCH = YES; - PRODUCT_VERSION = 0.10.9; + PRODUCT_VERSION = 0.10.10; SDKROOT = macosx; }; name = Release; From 81f341b368ec3417b1f35fe943573f5e677e4cba Mon Sep 17 00:00:00 2001 From: Norio Nomura Date: Wed, 26 Nov 2014 16:39:09 +0900 Subject: [PATCH 3/4] EasySIMBL-1.7.1 --- EasySIMBL/EasySIMBL-Info.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EasySIMBL/EasySIMBL-Info.plist b/EasySIMBL/EasySIMBL-Info.plist index a3432b7..44ce18a 100644 --- a/EasySIMBL/EasySIMBL-Info.plist +++ b/EasySIMBL/EasySIMBL-Info.plist @@ -32,11 +32,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.7 + 1.7.1 CFBundleSignature ???? CFBundleVersion - 10 + 11 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion From 0c7e9c21bf827639c7d62f637f3fd6f359b70b25 Mon Sep 17 00:00:00 2001 From: Norio Nomura Date: Wed, 26 Nov 2014 18:18:23 +0900 Subject: [PATCH 4/4] Update README.md --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 24a0bb2..6fa2990 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Changes from [original SIMBL](http://www.culater.net/software/SIMBL/SIMBL.php) How to install -------------- -1. Download [EasySIMBL-1.7.zip](http://github.com/norio-nomura/EasySIMBL/releases/download/EasySIMBL-1.7/EasySIMBL-1.7.zip) (2014/11/25 updated) +1. Download [EasySIMBL-1.7.1.zip](http://github.com/norio-nomura/EasySIMBL/releases/download/EasySIMBL-1.7.1/EasySIMBL-1.7.1.zip) (2014/11/26 updated) 2. Extract and move `EasySIMBL.app` into `/Applications` or `~/Applications`. 3. Launch `EasySIMBL.app` and check `Use SIMBL`, then quit `EasySIMBL.app`. @@ -37,20 +37,22 @@ Tested combinations of OS X and applications *This list includes combinations which I tested on my Mac.* - OS X 10.10.1 (14B25) + - Launchpad & [SpringboardSearchInRomanOnly 0.1](https://github.com/norio-nomura/SpringboardSearchInRomanOnly) - Maps 2.0 & [CopyLatLngOnMaps 0.1](https://github.com/norio-nomura/CopyLatLngOnMaps) - Safari 8.0 & [SafariStand 8.0.208](https://github.com/hetima/SafariStand) - Google Chrome 38.0.2125.122(32-bit) & [NoFavicons 1.2](https://github.com/michaelphines/NoFavicons) - [Twitter for Mac 3.1.0](https://itunes.apple.com/jp/app/twitter/id409789998?mt=12) & [SimblPluginsForTwitter 1.5](https://github.com/norio-nomura/SimblPluginsForTwitter) - OS X 10.9.5 (13F34) - Dock & [BlackDock 0.8.0](http://cooviewerzoom.web.fc2.com/blackdock.html) (without InjectIntoDock.scpt) - - Finder & [ColorfulSidebar 1.1.2](http://cooviewerzoom.web.fc2.com/colorfulsidebar.html) (without PowerboxInjector) - - Safari 7.0.1 & [SafariStand 6.0.200](https://github.com/hetima/SafariStand) + - Finder & [ColorfulSidebar 1.1.2](http://cooviewerzoom.web.fc2.com/colorfulsidebar.html) (without PowerboxInjector) + - Launchpad & [SpringboardSearchInRomanOnly 0.1](https://github.com/norio-nomura/SpringboardSearchInRomanOnly) + - Safari 7.0.1 & [SafariStand 6.0.200](https://github.com/hetima/SafariStand) - [Twitter for Mac 3.1.0](https://itunes.apple.com/jp/app/twitter/id409789998?mt=12) & [SimblPluginsForTwitter 1.5](https://github.com/norio-nomura/SimblPluginsForTwitter) - OS X 10.8.5 (12F45) - - Finder & [ColorfulSidebar 1.1.2](http://cooviewerzoom.web.fc2.com/colorfulsidebar.html) (without PowerboxInjector) - - Safari 6.1 & [SafariStand 6.0.200](https://github.com/hetima/SafariStand) + - Finder & [ColorfulSidebar 1.1.2](http://cooviewerzoom.web.fc2.com/colorfulsidebar.html) (without PowerboxInjector) + - Safari 6.1 & [SafariStand 6.0.200](https://github.com/hetima/SafariStand) - OS X 10.7.5 (11G63) - - Finder & [ColorfulSidebar 1.1.2](http://cooviewerzoom.web.fc2.com/colorfulsidebar.html) (without PowerboxInjector) + - Finder & [ColorfulSidebar 1.1.2](http://cooviewerzoom.web.fc2.com/colorfulsidebar.html) (without PowerboxInjector) _PowerboxInjector is not compatible with EasySIMBL. Sorry, the reason exists on EasySIMBL side._