Skip to content

Commit

Permalink
fixed installer to check/repair permissions.
Browse files Browse the repository at this point in the history
expunged dead code from agent.
added uninstaller.
  • Loading branch information
msolo committed Sep 11, 2009
1 parent c44cf96 commit 9c55c67
Show file tree
Hide file tree
Showing 8 changed files with 1,643 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .hgignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build
.DS_Store
rez/SIMBL.r
.*\.xcodeproj/.*\.(mode1v3|pbxuser)
.*\.xcodeproj/.*\.(mode*|pbxuser)
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
0.9.5 - Simpler AppleEvent delivery. Better installer package - fixes some permission issues with bad installs. Properly force agent to restart after the installer runs. Added uninstall script.

0.9.4 - Improved the bundle injection code which prevents an application from getting launched twice in some cases.

0.9.3 - Added compatibility with garbage collected applications. Installer now removes the InputManager version of SIMBL.
Expand Down
4 changes: 2 additions & 2 deletions SIMBL Agent/SIMBL Agent.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = "SIMBL Agent";
PRODUCT_VERSION = 0.9.4;
PRODUCT_VERSION = 0.9.5;
};
name = Debug;
};
Expand All @@ -235,7 +235,7 @@
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = "SIMBL Agent";
PRODUCT_VERSION = 0.9.4;
PRODUCT_VERSION = 0.9.5;
};
name = Release;
};
Expand Down
48 changes: 5 additions & 43 deletions SIMBL Agent/SIMBLAgent.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,43 +73,6 @@ - (void) loadInLaunchd
NSLog(@"launchctl returned %d", [task terminationStatus]);
}

#define SCRIPT_SRC_LEOPARD @"tell application \"%@\"\ninject SIMBL into Leopard\nend tell"
#define SCRIPT_SRC_SNOW_LEOPARD @"tell application \"%@\"\ninject SIMBL into Snow Leopard\nend tell"

- (void) _injectSIMBL:(NSNotification*)notification
{
/* injectSIMBL in a generic way that works, but it isn't specific to the
inbound notification. the code below is attempting to be more specific by
referencing the PSN, but it doesn't actually work.
*/
NSLog(@"received %@", [notification userInfo]);

unsigned majorOSVersion = 0;
unsigned minorOSVersion = 0;
unsigned buxfixOSVersion = 0;
[NSApp getSystemVersionMajor:&majorOSVersion minor:&minorOSVersion bugFix:&buxfixOSVersion];

if (majorOSVersion != 10) {
NSLog(@"something fishy - OS X version %u", majorOSVersion);
}

NSString* script_src = nil;
if (minorOSVersion > 5) {
script_src = [NSString stringWithFormat:SCRIPT_SRC_SNOW_LEOPARD,
[[notification userInfo] objectForKey:@"NSApplicationName"]];
}
else {
script_src = [NSString stringWithFormat:SCRIPT_SRC_LEOPARD,
[[notification userInfo] objectForKey:@"NSApplicationName"]];
}
NSLog(@"sending %@", script_src);
NSAppleScript* script = [[NSAppleScript alloc] initWithSource:script_src];
NSDictionary* errorInfo = nil;
NSAppleEventDescriptor* reply = [script executeAndReturnError:&errorInfo];
if (reply == nil)
NSLog(@"errors %@", errorInfo);
}

- (void) injectSIMBL:(NSNotification*)notification
{
NSLog(@"received %@", [notification userInfo]);
Expand All @@ -124,24 +87,23 @@ - (void) injectSIMBL:(NSNotification*)notification
NSLog(@"something fishy - OS X version %u", majorOSVersion);
return;
}

AEEventID eventID = minorOSVersion > 5 ? 'load' : 'leop';


// Find the process to target
pid_t pid = [[[notification userInfo] objectForKey: @"NSApplicationProcessIdentifier"] intValue];
pid_t pid = [[[notification userInfo] objectForKey:@"NSApplicationProcessIdentifier"] intValue];
SBApplication *app = [SBApplication applicationWithProcessIdentifier: pid];
if (!app) {
NSLog(@"Can't find app with pid %d", pid);
return;
}
[app setSendMode: kAENoReply];

[app setSendMode:kAENoReply];

// Force AppleScript to initialize in the app, by getting the dictionary
[app sendEvent: kASAppleScriptSuite id: kGetAEUT parameters: 0];
[app sendEvent:kASAppleScriptSuite id:kGetAEUT parameters:0];

// Inject!
[app sendEvent: 'SIMe' id: eventID parameters: 0];
[app sendEvent:'SIMe' id:eventID parameters:0];
}

@end
10 changes: 5 additions & 5 deletions SIMBL.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
isa = PBXContainerItemProxy;
containerPortal = 59AA8DF110585F5400EE21C9 /* SIMBL Agent.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 8D1107320486CEB800E47090 /* SIMBL Agent.app */;
remoteGlobalIDString = 8D1107320486CEB800E47090;
remoteInfo = "SIMBL Agent";
};
59AA8DFB10585F6400EE21C9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 59AA8DF110585F5400EE21C9 /* SIMBL Agent.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 8D1107260486CEB800E47090 /* SIMBL Agent */;
remoteGlobalIDString = 8D1107260486CEB800E47090;
remoteInfo = "SIMBL Agent";
};
/* End PBXContainerItemProxy section */
Expand Down Expand Up @@ -283,7 +283,7 @@
OTHER_LDFLAGS = "";
PREBINDING = NO;
PRODUCT_NAME = SIMBL;
PRODUCT_VERSION = 0.9.4;
PRODUCT_VERSION = 0.9.5;
SDKROOT = /Developer/SDKs/MacOSX10.5.sdk;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = (
Expand Down Expand Up @@ -326,7 +326,7 @@
OTHER_LDFLAGS = "";
PREBINDING = NO;
PRODUCT_NAME = SIMBL;
PRODUCT_VERSION = 0.9.4;
PRODUCT_VERSION = 0.9.5;
SDKROOT = /Developer/SDKs/MacOSX10.5.sdk;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = (
Expand Down Expand Up @@ -367,7 +367,7 @@
OTHER_LDFLAGS = "";
PREBINDING = NO;
PRODUCT_NAME = SIMBL;
PRODUCT_VERSION = 0.9.4;
PRODUCT_VERSION = 0.9.5;
SDKROOT = /Developer/SDKs/MacOSX10.5.sdk;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = (
Expand Down
Loading

0 comments on commit 9c55c67

Please sign in to comment.