├── .gitignore ├── LICENSE ├── README.md ├── SpotlightFinder.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── SpotlightFinder.xccheckout │ └── xcuserdata │ │ └── josip04.xcuserdatad │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ └── josip04.xcuserdatad │ └── xcschemes │ ├── SpotlightFinder.xcscheme │ └── xcschememanagement.plist ├── SpotlightFinder ├── Info.plist ├── SPOTFinder.h └── SPOTFinder.m └── previews ├── install.png ├── preview.gif ├── remove.png └── restart.png /.gitignore: -------------------------------------------------------------------------------- 1 | SpotlightFinder.xcodeproj/project.xcworkspace/xcuserdata/josip04.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Josip Cavar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SpotlightFinder 2 | =============== 3 | 4 | SpotlightFinder is Spotlight plugin which adds show in Finder option 5 | 6 | ![Preview](https://raw.githubusercontent.com/jcavar/SpotlightFinder/master/previews/preview.gif) 7 | 8 | ##Install 9 | 10 | SpotlightFinder can be installed via [EasySIMBL](https://github.com/norio-nomura/EasySIMBL). 11 | 12 | There are two ways to do this: 13 | 14 | * Download latest bundle directly from [releases](https://github.com/jcavar/SpotlightFinder/releases/latest) then just drag and drop ti to EasySIMBL 15 | 16 | * Download source code, open it with Xcode and build project. After that, find SpotlightFinder.bundle file, drag and drop it to EasySIMBL 17 | 18 | ![Preview](https://raw.githubusercontent.com/jcavar/SpotlightFinder/master/previews/install.png) 19 | 20 | If you use great Spotlight plugin system [Flashlight](http://flashlight.nateparrott.com/) there is a way to use SpotlightFinder within it. Just move SpotlightFinder.bundle file into `Flashlight.app/Contents/Library/LoginItems/FlashlightSIMBLAgent.app/Contents/Resources/SIMBLPlugins` 21 | 22 | ##Uninstall 23 | 24 | Just remove bundle from folder where it is installed. 25 | 26 | ##Troubleshooting 27 | 28 | If you have any problems either with installation or uninstallation, you can try to restart Spotlight in Activity Monitor. 29 | 30 | ![Preview](https://raw.githubusercontent.com/jcavar/SpotlightFinder/master/previews/remove.png) 31 | 32 | If you use SpotlightFinder in Flashlight, you can try to disable and then enable plugins. 33 | 34 | ![Preview](https://raw.githubusercontent.com/jcavar/SpotlightFinder/master/previews/restart.png) 35 | 36 | If you have any other problems feel free to open [new issue](https://github.com/jcavar/SpotlightFinder/issues/new) 37 | -------------------------------------------------------------------------------- /SpotlightFinder.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C73706FB1A378AA80081CBDE /* SPOTFinder.m in Sources */ = {isa = PBXBuildFile; fileRef = C73706F91A378AA80081CBDE /* SPOTFinder.m */; }; 11 | /* End PBXBuildFile section */ 12 | 13 | /* Begin PBXFileReference section */ 14 | C73706F71A378AA80081CBDE /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 15 | C73706F81A378AA80081CBDE /* SPOTFinder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPOTFinder.h; sourceTree = ""; }; 16 | C73706F91A378AA80081CBDE /* SPOTFinder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPOTFinder.m; sourceTree = ""; }; 17 | C7C41ECB1A37465000515EEF /* SpotlightFinder.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SpotlightFinder.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 18 | /* End PBXFileReference section */ 19 | 20 | /* Begin PBXFrameworksBuildPhase section */ 21 | C7C41EC81A37465000515EEF /* Frameworks */ = { 22 | isa = PBXFrameworksBuildPhase; 23 | buildActionMask = 2147483647; 24 | files = ( 25 | ); 26 | runOnlyForDeploymentPostprocessing = 0; 27 | }; 28 | /* End PBXFrameworksBuildPhase section */ 29 | 30 | /* Begin PBXGroup section */ 31 | C73706F61A378AA80081CBDE /* SpotlightFinder */ = { 32 | isa = PBXGroup; 33 | children = ( 34 | C73706F81A378AA80081CBDE /* SPOTFinder.h */, 35 | C73706F91A378AA80081CBDE /* SPOTFinder.m */, 36 | C73706F71A378AA80081CBDE /* Info.plist */, 37 | ); 38 | path = SpotlightFinder; 39 | sourceTree = ""; 40 | }; 41 | C7C41EC21A37465000515EEF = { 42 | isa = PBXGroup; 43 | children = ( 44 | C73706F61A378AA80081CBDE /* SpotlightFinder */, 45 | C7C41ECC1A37465000515EEF /* Products */, 46 | ); 47 | sourceTree = ""; 48 | }; 49 | C7C41ECC1A37465000515EEF /* Products */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | C7C41ECB1A37465000515EEF /* SpotlightFinder.bundle */, 53 | ); 54 | name = Products; 55 | sourceTree = ""; 56 | }; 57 | /* End PBXGroup section */ 58 | 59 | /* Begin PBXNativeTarget section */ 60 | C7C41ECA1A37465000515EEF /* SpotlightFinder */ = { 61 | isa = PBXNativeTarget; 62 | buildConfigurationList = C7C41ED21A37465000515EEF /* Build configuration list for PBXNativeTarget "SpotlightFinder" */; 63 | buildPhases = ( 64 | C7C41EC71A37465000515EEF /* Sources */, 65 | C7C41EC81A37465000515EEF /* Frameworks */, 66 | C7C41EC91A37465000515EEF /* Resources */, 67 | ); 68 | buildRules = ( 69 | ); 70 | dependencies = ( 71 | ); 72 | name = SpotlightFinder; 73 | productName = spfinder; 74 | productReference = C7C41ECB1A37465000515EEF /* SpotlightFinder.bundle */; 75 | productType = "com.apple.product-type.bundle"; 76 | }; 77 | /* End PBXNativeTarget section */ 78 | 79 | /* Begin PBXProject section */ 80 | C7C41EC31A37465000515EEF /* Project object */ = { 81 | isa = PBXProject; 82 | attributes = { 83 | LastUpgradeCheck = 0610; 84 | ORGANIZATIONNAME = "Josip Cavar"; 85 | TargetAttributes = { 86 | C7C41ECA1A37465000515EEF = { 87 | CreatedOnToolsVersion = 6.1.1; 88 | }; 89 | }; 90 | }; 91 | buildConfigurationList = C7C41EC61A37465000515EEF /* Build configuration list for PBXProject "SpotlightFinder" */; 92 | compatibilityVersion = "Xcode 3.2"; 93 | developmentRegion = English; 94 | hasScannedForEncodings = 0; 95 | knownRegions = ( 96 | en, 97 | ); 98 | mainGroup = C7C41EC21A37465000515EEF; 99 | productRefGroup = C7C41ECC1A37465000515EEF /* Products */; 100 | projectDirPath = ""; 101 | projectRoot = ""; 102 | targets = ( 103 | C7C41ECA1A37465000515EEF /* SpotlightFinder */, 104 | ); 105 | }; 106 | /* End PBXProject section */ 107 | 108 | /* Begin PBXResourcesBuildPhase section */ 109 | C7C41EC91A37465000515EEF /* Resources */ = { 110 | isa = PBXResourcesBuildPhase; 111 | buildActionMask = 2147483647; 112 | files = ( 113 | ); 114 | runOnlyForDeploymentPostprocessing = 0; 115 | }; 116 | /* End PBXResourcesBuildPhase section */ 117 | 118 | /* Begin PBXSourcesBuildPhase section */ 119 | C7C41EC71A37465000515EEF /* Sources */ = { 120 | isa = PBXSourcesBuildPhase; 121 | buildActionMask = 2147483647; 122 | files = ( 123 | C73706FB1A378AA80081CBDE /* SPOTFinder.m in Sources */, 124 | ); 125 | runOnlyForDeploymentPostprocessing = 0; 126 | }; 127 | /* End PBXSourcesBuildPhase section */ 128 | 129 | /* Begin XCBuildConfiguration section */ 130 | C7C41ED01A37465000515EEF /* Debug */ = { 131 | isa = XCBuildConfiguration; 132 | buildSettings = { 133 | ALWAYS_SEARCH_USER_PATHS = NO; 134 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 135 | CLANG_CXX_LIBRARY = "libc++"; 136 | CLANG_ENABLE_MODULES = YES; 137 | CLANG_ENABLE_OBJC_ARC = YES; 138 | CLANG_WARN_BOOL_CONVERSION = YES; 139 | CLANG_WARN_CONSTANT_CONVERSION = YES; 140 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 141 | CLANG_WARN_EMPTY_BODY = YES; 142 | CLANG_WARN_ENUM_CONVERSION = YES; 143 | CLANG_WARN_INT_CONVERSION = YES; 144 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 145 | CLANG_WARN_UNREACHABLE_CODE = YES; 146 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 147 | COPY_PHASE_STRIP = NO; 148 | ENABLE_STRICT_OBJC_MSGSEND = YES; 149 | GCC_C_LANGUAGE_STANDARD = gnu99; 150 | GCC_DYNAMIC_NO_PIC = NO; 151 | GCC_OPTIMIZATION_LEVEL = 0; 152 | GCC_PREPROCESSOR_DEFINITIONS = ( 153 | "DEBUG=1", 154 | "$(inherited)", 155 | ); 156 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 157 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 158 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 159 | GCC_WARN_UNDECLARED_SELECTOR = YES; 160 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 161 | GCC_WARN_UNUSED_FUNCTION = YES; 162 | GCC_WARN_UNUSED_VARIABLE = YES; 163 | MACOSX_DEPLOYMENT_TARGET = 10.10; 164 | MTL_ENABLE_DEBUG_INFO = YES; 165 | ONLY_ACTIVE_ARCH = YES; 166 | SDKROOT = macosx; 167 | }; 168 | name = Debug; 169 | }; 170 | C7C41ED11A37465000515EEF /* Release */ = { 171 | isa = XCBuildConfiguration; 172 | buildSettings = { 173 | ALWAYS_SEARCH_USER_PATHS = NO; 174 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 175 | CLANG_CXX_LIBRARY = "libc++"; 176 | CLANG_ENABLE_MODULES = YES; 177 | CLANG_ENABLE_OBJC_ARC = YES; 178 | CLANG_WARN_BOOL_CONVERSION = YES; 179 | CLANG_WARN_CONSTANT_CONVERSION = YES; 180 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 181 | CLANG_WARN_EMPTY_BODY = YES; 182 | CLANG_WARN_ENUM_CONVERSION = YES; 183 | CLANG_WARN_INT_CONVERSION = YES; 184 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 185 | CLANG_WARN_UNREACHABLE_CODE = YES; 186 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 187 | COPY_PHASE_STRIP = YES; 188 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 189 | ENABLE_NS_ASSERTIONS = NO; 190 | ENABLE_STRICT_OBJC_MSGSEND = YES; 191 | GCC_C_LANGUAGE_STANDARD = gnu99; 192 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 193 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 194 | GCC_WARN_UNDECLARED_SELECTOR = YES; 195 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 196 | GCC_WARN_UNUSED_FUNCTION = YES; 197 | GCC_WARN_UNUSED_VARIABLE = YES; 198 | MACOSX_DEPLOYMENT_TARGET = 10.10; 199 | MTL_ENABLE_DEBUG_INFO = NO; 200 | SDKROOT = macosx; 201 | }; 202 | name = Release; 203 | }; 204 | C7C41ED31A37465000515EEF /* Debug */ = { 205 | isa = XCBuildConfiguration; 206 | buildSettings = { 207 | COMBINE_HIDPI_IMAGES = YES; 208 | INFOPLIST_FILE = SpotlightFinder/Info.plist; 209 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; 210 | PRODUCT_NAME = "$(TARGET_NAME)"; 211 | SKIP_INSTALL = YES; 212 | WRAPPER_EXTENSION = bundle; 213 | }; 214 | name = Debug; 215 | }; 216 | C7C41ED41A37465000515EEF /* Release */ = { 217 | isa = XCBuildConfiguration; 218 | buildSettings = { 219 | COMBINE_HIDPI_IMAGES = YES; 220 | INFOPLIST_FILE = SpotlightFinder/Info.plist; 221 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; 222 | PRODUCT_NAME = "$(TARGET_NAME)"; 223 | SKIP_INSTALL = YES; 224 | WRAPPER_EXTENSION = bundle; 225 | }; 226 | name = Release; 227 | }; 228 | /* End XCBuildConfiguration section */ 229 | 230 | /* Begin XCConfigurationList section */ 231 | C7C41EC61A37465000515EEF /* Build configuration list for PBXProject "SpotlightFinder" */ = { 232 | isa = XCConfigurationList; 233 | buildConfigurations = ( 234 | C7C41ED01A37465000515EEF /* Debug */, 235 | C7C41ED11A37465000515EEF /* Release */, 236 | ); 237 | defaultConfigurationIsVisible = 0; 238 | defaultConfigurationName = Release; 239 | }; 240 | C7C41ED21A37465000515EEF /* Build configuration list for PBXNativeTarget "SpotlightFinder" */ = { 241 | isa = XCConfigurationList; 242 | buildConfigurations = ( 243 | C7C41ED31A37465000515EEF /* Debug */, 244 | C7C41ED41A37465000515EEF /* Release */, 245 | ); 246 | defaultConfigurationIsVisible = 0; 247 | defaultConfigurationName = Release; 248 | }; 249 | /* End XCConfigurationList section */ 250 | }; 251 | rootObject = C7C41EC31A37465000515EEF /* Project object */; 252 | } 253 | -------------------------------------------------------------------------------- /SpotlightFinder.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SpotlightFinder.xcodeproj/project.xcworkspace/xcshareddata/SpotlightFinder.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 56B75817-15D8-4208-8AEA-011F749844B5 9 | IDESourceControlProjectName 10 | SpotlightFinder 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 40F1FB8D02BF9B095165D62169D4181163A1FE53 14 | https://github.com/jcavar/SpotlightFinder.git 15 | 16 | IDESourceControlProjectPath 17 | SpotlightFinder.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 40F1FB8D02BF9B095165D62169D4181163A1FE53 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/jcavar/SpotlightFinder.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 40F1FB8D02BF9B095165D62169D4181163A1FE53 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 40F1FB8D02BF9B095165D62169D4181163A1FE53 36 | IDESourceControlWCCName 37 | SpotlightFinder 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /SpotlightFinder.xcodeproj/project.xcworkspace/xcuserdata/josip04.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SpotlightFinder.xcodeproj/xcuserdata/josip04.xcuserdatad/xcschemes/SpotlightFinder.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 60 | 61 | 67 | 68 | 69 | 70 | 72 | 73 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /SpotlightFinder.xcodeproj/xcuserdata/josip04.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SpotlightFinder.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | C7C41ECA1A37465000515EEF 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /SpotlightFinder/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | JC.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | NSHumanReadableCopyright 24 | Copyright © 2014 Josip Cavar. All rights reserved. 25 | NSPrincipalClass 26 | SPOTFinder 27 | SIMBLTargetApplications 28 | 29 | 30 | BundleIdentifier 31 | com.apple.Spotlight 32 | MinBundleVersion 33 | 1 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /SpotlightFinder/SPOTFinder.h: -------------------------------------------------------------------------------- 1 | // 2 | // SPFinder.h 3 | // SpotlightFinder 4 | // 5 | // Created by Josip Cavar on 09/12/14. 6 | // Copyright (c) 2014 Josip Cavar. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface SPOTResult : NSObject 13 | 14 | @property __weak NSString *filePath; 15 | 16 | @end 17 | 18 | @interface SPSearchField : NSTextField 19 | 20 | @end 21 | 22 | @interface SPSearchPanel : NSPanel 23 | 24 | @property struct CGSize contentMaxSizeWhenExpanded; // @synthesize contentMaxSizeWhenExpanded=_contentMaxSizeWhenExpanded; 25 | @property BOOL collapsedState; // @synthesize collapsedState=_collapsedState; 26 | @property BOOL internalCollapsed; // @synthesize internalCollapsed=_internalCollapsed; 27 | @property(retain) NSView *mainView; // @synthesize mainView=_mainView; 28 | @property __weak NSView *resultsView; // @synthesize resultsView=_resultsView; 29 | @property __weak SPSearchField *searchField; // @synthesize searchField=_searchField; 30 | @property __weak NSView *topView; // @synthesize topView=_topView; 31 | 32 | @end 33 | 34 | @interface SPAppDelegate : NSObject 35 | 36 | @property __weak SPSearchPanel *window; // @synthesize window=_window; 37 | - (id)selectedResult; 38 | 39 | @end 40 | 41 | @interface SPOTFinder : NSObject 42 | 43 | @property (strong, nonatomic) NSButton *buttonShowInFinder; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /SpotlightFinder/SPOTFinder.m: -------------------------------------------------------------------------------- 1 | // 2 | // SPFinder.m 3 | // SpotlightFinder 4 | // 5 | // Created by Josip Cavar on 09/12/14. 6 | // Copyright (c) 2014 Josip Cavar. All rights reserved. 7 | // 8 | 9 | #import "SPOTFinder.h" 10 | #import 11 | 12 | @implementation SPOTFinder 13 | 14 | + (instancetype)sharedInstance { 15 | 16 | static id plugin = nil; 17 | if (plugin == nil) { 18 | plugin = [[self alloc] init]; 19 | } 20 | return plugin; 21 | } 22 | 23 | + (void)load { 24 | 25 | NSLog(@"SPOTFinder loaded"); 26 | id plugin = [self sharedInstance]; 27 | if (plugin) { 28 | SPAppDelegate *appDelegate = [NSApp delegate]; 29 | NSView *view = appDelegate.window.topView; 30 | NSButton *button = [[NSButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(appDelegate.window.searchField.frame) - CGRectGetHeight(appDelegate.window.searchField.frame), CGRectGetMinY(appDelegate.window.searchField.frame), CGRectGetHeight(appDelegate.window.searchField.frame), CGRectGetHeight(appDelegate.window.searchField.frame))]; 31 | [button setButtonType:NSMomentaryPushInButton]; 32 | [button setBezelStyle: NSRoundedDisclosureBezelStyle]; 33 | [button setImagePosition:NSImageOnly]; 34 | button.transparent = YES; 35 | [button setImage:[NSImage imageNamed:NSImageNameRevealFreestandingTemplate]]; 36 | button.autoresizingMask = NSViewNotSizable | NSViewMaxYMargin | NSViewMaxYMargin; 37 | [button setTarget:[self sharedInstance]]; 38 | [button setAction:@selector(buttonShowInFinderOnClick)]; 39 | [view addSubview:button]; 40 | 41 | [SPOTFinder sharedInstance].buttonShowInFinder = button; 42 | 43 | Class workspaceTabController = NSClassFromString(@"SPAppDelegate"); 44 | Method buildMethod = class_getInstanceMethod(workspaceTabController, NSSelectorFromString(@"didShowPreviewItem:")); 45 | Method buildReplaceMethod = class_getInstanceMethod(workspaceTabController, NSSelectorFromString(@"didShowPreviewItemReplace:")); 46 | method_exchangeImplementations(buildMethod, buildReplaceMethod); 47 | } 48 | } 49 | 50 | - (void)buttonShowInFinderOnClick { 51 | 52 | SPAppDelegate *appDelegate = [NSApp delegate]; 53 | if ([[appDelegate selectedResult] respondsToSelector:@selector(filePath)]) { 54 | id result = [[appDelegate selectedResult] filePath]; 55 | if ([result isKindOfClass:NSString.class]) { 56 | NSLog(@"SPOTFinder opening path %@", result); 57 | [[NSWorkspace sharedWorkspace] selectFile:result inFileViewerRootedAtPath:@""]; 58 | } 59 | } 60 | } 61 | 62 | @end 63 | 64 | @implementation NSObject (SPOTAdditions) 65 | 66 | - (void)didShowPreviewItemReplace:(id)arg { 67 | 68 | NSLog(@"SPOTFinder called show preview"); 69 | [SPOTFinder sharedInstance].buttonShowInFinder.hidden = YES; 70 | SPAppDelegate *appDelegate = [NSApp delegate]; 71 | if ([[appDelegate selectedResult] respondsToSelector:@selector(filePath)]) { 72 | id result = [[appDelegate selectedResult] filePath]; 73 | if ([result isKindOfClass:NSString.class]) { 74 | NSLog(@"SPOTFinder selected path %@", result); 75 | [SPOTFinder sharedInstance].buttonShowInFinder.hidden = NO; 76 | } 77 | } 78 | [self didShowPreviewItemReplace:arg]; 79 | } 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /previews/install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcavar/SpotlightFinder/dacf556768979a2e9267edd02b9991723f48e154/previews/install.png -------------------------------------------------------------------------------- /previews/preview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcavar/SpotlightFinder/dacf556768979a2e9267edd02b9991723f48e154/previews/preview.gif -------------------------------------------------------------------------------- /previews/remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcavar/SpotlightFinder/dacf556768979a2e9267edd02b9991723f48e154/previews/remove.png -------------------------------------------------------------------------------- /previews/restart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcavar/SpotlightFinder/dacf556768979a2e9267edd02b9991723f48e154/previews/restart.png --------------------------------------------------------------------------------