diff --git a/FlashlightApp/EasySIMBL/Flashlight-Info.plist b/FlashlightApp/EasySIMBL/Flashlight-Info.plist index ffd75b88..a3982caa 100755 --- a/FlashlightApp/EasySIMBL/Flashlight-Info.plist +++ b/FlashlightApp/EasySIMBL/Flashlight-Info.plist @@ -32,7 +32,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.9 + 0.1 CFBundleSignature ???? CFBundleVersion @@ -41,8 +41,6 @@ public.app-category.utilities LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} - NSHumanReadableCopyright - ${EXECUTABLE_NAME} ${PRODUCT_VERSION}, ©2012 Norio Nomura NSMainNibFile MainMenu NSPrincipalClass diff --git a/FlashlightApp/EasySIMBL/PluginListController.m b/FlashlightApp/EasySIMBL/PluginListController.m index e6fd89ee..80be5c59 100644 --- a/FlashlightApp/EasySIMBL/PluginListController.m +++ b/FlashlightApp/EasySIMBL/PluginListController.m @@ -45,6 +45,11 @@ - (void)tableView:(NSTableView *)tableView didAddRowView:(NSTableRowView *)rowVi ((PluginCellView *)[rowView viewAtColumn:0]).listController = self; } +- (NSIndexSet *)tableView:(NSTableView *)tableView +selectionIndexesForProposedSelection:(NSIndexSet *)proposedSelectionIndexes { + return nil; +} + #pragma mark Data - (IBAction)reloadPluginsFromWeb:(id)sender { [self.failedToLoadDirectoryBanner setHidden:YES]; diff --git a/FlashlightApp/EasySIMBL/en.lproj/MainMenu.xib b/FlashlightApp/EasySIMBL/en.lproj/MainMenu.xib index 2416ea08..82893eb1 100755 --- a/FlashlightApp/EasySIMBL/en.lproj/MainMenu.xib +++ b/FlashlightApp/EasySIMBL/en.lproj/MainMenu.xib @@ -674,7 +674,7 @@ - + @@ -793,7 +793,7 @@ - + @@ -873,6 +873,6 @@ Gw - + diff --git a/FlashlightApp/Flashlight.xcodeproj/project.pbxproj b/FlashlightApp/Flashlight.xcodeproj/project.pbxproj index 983fb4b1..c41b7f5a 100755 --- a/FlashlightApp/Flashlight.xcodeproj/project.pbxproj +++ b/FlashlightApp/Flashlight.xcodeproj/project.pbxproj @@ -545,6 +545,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "EasySIMBL/Flashlight-Prefix.pch"; INFOPLIST_FILE = "EasySIMBL/Flashlight-Info.plist"; + MACOSX_DEPLOYMENT_TARGET = 10.10; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -558,6 +559,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "EasySIMBL/Flashlight-Prefix.pch"; INFOPLIST_FILE = "EasySIMBL/Flashlight-Info.plist"; + MACOSX_DEPLOYMENT_TARGET = 10.10; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; diff --git a/README.md b/README.md index 7e1bc5f7..badf68b7 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,44 @@ Flashlight ========== +_The missing Spotlight plugin system_ + +![Image of a Spotlight window showing 'ellohay orldway' as the Pig Latin translation of 'hello world'](https://raw.github.com/nate-parrott/flashlight/master/PigLatinExampleImage.png) ![Image of a a UI for selecting Spotlight plugins](https://raw.github.com/nate-parrott/flashlight/master/UIExampleImage.png) + Flashlight is an **unofficial Spotlight API** that allows you to programmatically process queries and add additional results. It's *very rough right now,* and a *horrendous hack*, but a fun proof of concept. **Installation** -Flashlight depends on [EasySIMBL](https://github.com/norio-nomura/EasySIMBL), a runtime code-injection framework. (like MobileSubstrate, but for OS X). - -When you build and run the Xcode project, it generates a bundle called `SpotlightSIMBL.bundle`, automatically copies it to `~/Library/Application Support/SIMBL/Plugins`, then restarts Spotlight. +Clone and build using Xcode, or [download Flashlight.app from _releases_](https://github.com/nate-parrott/Flashlight/releases). **API** -After installation, Flashlight reads plugins from `~/Library/FlashlightPlugins`. Each plugin must be a directory containing an executable named `executable`. - -Every time you type a character into Spotlight, each plugin's executable will be invoked with your query as the first argument (`argv[1]`). If the plugin decides to respond to the query, it should print a json document to `stdout` in this format: +Flashlight plugins are `.bundle` files in `~/Library/FlashlightPlugins`. They have a simple directory structure: ``` -{ - "title": "'Hello world' in Pig Latin", - "html": "

ellohay, orldway

", - "execute": "(shell string to execute when enter is pressed)" -} +- MyPlugin.bundle + - executable + (probably a script in your favorite language, starting with #!/usr/bin/python|ruby|php|bash) + - Info.plist + (create these with Xcode. Must contain 'CFBundleDisplayName' and 'Description' keys) ``` -(if the plugin doesn't want to provide a response, just don't print anything.) +When you enter text into Spotlight, Flashlight will invoke all the `*.bundle/executable` files. (in order for the system to know what interpreter to use, you've got to include the [shebang line](http://en.wikipedia.org/wiki/Shebang_(Unix)).) -This HTML will then be presented to the user: +Flashlight will pass the Spotlight query as the first argument (`argv[1]`). -![Image of a Spotlight window showing 'ellohay orldway' as the Pig Latin translation of 'hello world'](https://raw.github.com/nate-parrott/flashlight/master/PigLatinExampleImage.png) +If you want to show a search result, just print a JSON structure to stdout: + +``` +{ + "title": "Search result title", + "html": "

HTML to show inline inside Spotlight

", + "execute": "bash shell script to run if the user hits enter" +} +``` -(this HTML will be loaded with the plugin's directory as its base URL, so you can reference images, javascript and CSS from it.) +For examples, look at the ['say' example](https://github.com/nate-parrott/Flashlight/tree/master/PluginDirectory/say.bundle) or the [Pig Latin example](https://github.com/nate-parrott/Flashlight/tree/master/PluginDirectory/piglatin.bundle). -This is currently all the API does. More capabilities, like more customization of the search result, are on my to-do list. **How it works** diff --git a/UIExampleImage.png b/UIExampleImage.png new file mode 100644 index 00000000..d560f31d Binary files /dev/null and b/UIExampleImage.png differ