Skip to content

Interact with MacOS Core Spotlight from Electron

License

Notifications You must be signed in to change notification settings

MeetBit/electron-spotlight

 
 

Repository files navigation

electron-spotlight

Index or remove items in macOS Spotlight, using a native Node module.

Quick-start

npm i electron-spotlight
import { addItems } from 'electron-spotlight';

addItems([{
  id: 'your-unique-identifier',
  title: 'Title In Spotlight',
  contentDescription: `Description for item`,
  icon: 'https://pbs.twimg.com/media/CdlFCYmXIAAGkiH.jpg'
}])

API

addItems(items: Array<SearchItem>)

Index items within Spotlight. Maps to indexSearchableItems.

export interface SearchItem {
  id: string;
  title: string;
  displayName?: string;
  contentDescription?: string;
  domainIdentifier?: string;
  icon?: string;
}

Note that you must be on a signed build to communicate with corespotlightd. Otherwise you'll see Unable to communicate with helper app.

removeItems(ids: Array<string>)

Removes items from Spotlight according to their unique identifier. Maps to deleteSearchableItemsWithIdentifiers.

removeAllItems()

Removes all items from Spotlight indexing. Maps to deleteAllSearchableItemsWithCompletionHandler.

About

Interact with MacOS Core Spotlight from Electron

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Objective-C++ 76.2%
  • C++ 12.2%
  • Python 7.3%
  • C 3.3%
  • JavaScript 1.0%