- Notifications
You must be signed in to change notification settings - Fork404
How Flashlight Works Internally
Note: this is slightly out-of-date, but more or less accurate
TheFlashlight.app
Xcode target is a fork ofEasySIMBL (which is designed to allow loading runtime injection of plugins into arbitrary apps) that's been modified to load a single plugin (stored inside its own bundle, rather than an external directory) into the Spotlight process. It should be able to coexist with EasySIMBL if you use it.
The SIMBL plugin that's loaded into Spotlight,SpotlightSIMBL.bundle
, patches Spotlight to add a new subclass ofSPQuery
, the internal class used to fetch results from different sources. It runs a bundled Python script, which usescommanding to parse queries and determine their intents and parameters, then invokes the appropriate plugin'splugin.py
script and presents the results using a custom subclass ofSPResult
.
SinceI'm not sure how to subclass classes that aren't available at link time, subclasses of Spotlight internal classes are made at runtime usingMike Ash's instructions and helper code.
The Spotlight plugin is gated to run only on versions911-916
(Yosemite GM through 10.10.2 seed). If a new version of Spotlight comes out, you can manually editSpotlightSIMBL/SpotlightSIMBL/Info.plist
keySIMBLTargetApplications.MaxBundleVersion
, restarts Spotlight, verify everything works, and then submit a pull request.