Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/charliehess/electron-spotlight
Add items to macOS Spotlight from Electron
https://github.com/charliehess/electron-spotlight
Last synced: 7 days ago
JSON representation
Add items to macOS Spotlight from Electron
- Host: GitHub
- URL: https://github.com/charliehess/electron-spotlight
- Owner: CharlieHess
- License: mit
- Created: 2018-03-06T19:31:01.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-05-02T10:06:30.000Z (over 2 years ago)
- Last Synced: 2024-08-09T00:28:02.014Z (3 months ago)
- Language: Objective-C++
- Homepage:
- Size: 38.1 KB
- Stars: 20
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# electron-spotlight
Index or remove items in macOS Spotlight, using a native Node module.## Quick-start
```
npm i electron-spotlight
`````` js
import { addItems } from 'electron-spotlight';addItems([{
id: 'your-unique-identifier',
title: 'Title In Spotlight',
icon: 'https://pbs.twimg.com/media/CdlFCYmXIAAGkiH.jpg'
}])
```## API
### `addItems(items: Array)`
Index items within Spotlight. Maps to [`indexSearchableItems`](https://developer.apple.com/documentation/corespotlight/cssearchableindex/1620333-indexsearchableitems?language=objc).```
export interface SearchItem {
id: string;
title: 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)`
Removes items from Spotlight according to their unique identifier. Maps to [`deleteSearchableItemsWithIdentifiers`](https://developer.apple.com/documentation/corespotlight/cssearchableindex/1620337-deletesearchableitemswithidentif?language=objc).### `removeAllItems()`
Removes all items from Spotlight indexing. Maps to [`deleteAllSearchableItemsWithCompletionHandler`](https://developer.apple.com/documentation/corespotlight/cssearchableindex/1620342-deleteallsearchableitemswithcomp?language=objc).