Open quentinmit opened 9 years ago
SIMBL Agent.app is using [[NSWorkspace sharedWorkspace]runningApplications]
for observing application launching. For injecting EasySIMBL.osax to target application, SIMBL Agent.app will wait until isFinishedLaunching
of target application will be true as following:
https://github.com/norio-nomura/EasySIMBL/blob/master/SIMBL%20Agent/SIMBLAgent.m#L100-L103
As I tested on developing earlier version of EasySIMBL, injecting did fail if the injecting message sent while isFinishedLaunching
was false. isFinishedLaunching
will be true on posting NSApplicationDidFinishLaunchingNotification
in target application.
The notification will trigger -[NSApplicationDelegate applicationDidFinishLaunching:]
in target application.
There are some overhead of injecting containers for sandboxed applications. But if I would change to reducing the overhead that SIMBL Agent.app will injecting containers before isFinishedLaunching
will be true, SIMBL Agent.app will not be able to inject plugins earlier than that delegate method calling in target application.
If injecting did happen on far later timing in your target application, it may be specific issue on your target application.
Looking at one particular example, NSWorkspaceWillLaunchApplicationNotification
is posted at 11:15:41. NSWorkspaceDidLaunchApplicationNotification
is posted 5 seconds later at 11:15:46. Then my SIMBL plugin doesn't log its first message (which happens immediately on load) until 3 seconds later, at 11:15:49. This is far too late to swizzle methods that are involved in opening the initial windows.
I noticed that there was a AppleTextInputMenuExtraDidLoadNotification
posted at 11:15:43; I wonder what that is and if it could be used as an indication that we can start trying to load EasySIMBL.
I'm testing with an unsandboxed app, so it's not that.
I'm trying to write a SIMBL plugin that requires method swizzling. It looks like the plugin isn't being injected until very far in the application launch process - judging from the logs, it looks like it's not injected until after the application has fully launched and even opened/reopened its document windows.
Is there any way that EasySIMBL might be able to inject plugins earlier?