-
Notifications
You must be signed in to change notification settings - Fork 12
Add SearchProvider2 and ResultMeta interfaces #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| export * from './extension-metadata.js'; | ||
| export * from './extension-object.js'; | ||
| export * from './search-provider.js'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| import type Gio from '@girs/gio-2.0'; | ||
| import type Clutter from '@girs/clutter-17'; | ||
|
|
||
| /** Contract interface between GNOME Shell and Shell extensions that implement | ||
| * a search provider. | ||
| * | ||
| * This interface defines the required methods and properties that must be | ||
| * implemented by any Shell extension to provide custom search functionality | ||
| * integrated with GNOME Shell's search system. | ||
| * */ | ||
| export interface SearchProvider2 { | ||
|
|
||
| /** Unique string identifier of the search provider in the system. */ | ||
| readonly id: string; | ||
|
|
||
| /** The search provider's `GAppInfo`. */ | ||
| readonly appInfo: Gio.AppInfo | null; | ||
|
|
||
| /** Controls the visibility of the "Show more results" action. */ | ||
| readonly canLaunchSearch: boolean; | ||
|
|
||
| /** Handles Shell's request for an initial search and returns | ||
| * string identifiers of the found results. | ||
| * | ||
| * **NOTE**: The implementation **must** abort the search upon signal from the | ||
| * `cancellable` object. | ||
| * | ||
| * @param terms Array of search terms | ||
| * @param cancellable Object for cancelling the operation | ||
| * @returns Promise that resolves to an array of result identifiers */ | ||
| getInitialResultSet(terms: string[], cancellable: Gio.Cancellable): Promise<string[]>; | ||
|
|
||
| /** Handles Shell's request to refine search results when new | ||
| * search terms are added. | ||
| * | ||
| * Returns a subset of the original result set or the result of a new | ||
| * search. | ||
| * | ||
| * **NOTE**: The implementation **must** abort the search upon signal from the | ||
| * `cancellable` object. | ||
| * | ||
| * @param previousIdentifiers Result identifiers from the previous search | ||
| * @param terms Array of new search terms | ||
| * @param cancellable Object for cancelling the operation | ||
| * @returns Promise that resolves to an array of result identifiers */ | ||
| getSubsearchResultSet(previousIdentifiers: string[], terms: string[], cancellable: Gio.Cancellable): Promise<string[]>; | ||
|
|
||
| /** Handles Shell's request to reduce the number of displayed results | ||
| * for the current search. | ||
| * | ||
| * @param identifiers Complete list of current result identifiers | ||
| * @param maxResults Desired maximum number of results to display | ||
| * @returns Truncated array of result identifiers */ | ||
| filterResults(identifiers: string[], maxResults: number): string[]; | ||
|
|
||
| /** Handles Shell's request to retrieve result metadata for display | ||
| * in the UI. | ||
| * | ||
| * **NOTE**: The implementation **must** abort processing upon signal from the | ||
| * `cancellable` object. | ||
| * | ||
| * @param identifiers List of identifiers | ||
| * @param cancellable Object for cancelling the operation | ||
| * @returns Promise that resolves to an array of metadata for each | ||
| * result from `identifiers` */ | ||
| getResultMetas(identifiers: string[], cancellable: Gio.Cancellable): Promise<ResultMeta[]>; | ||
|
|
||
| /** Handles Shell's request to retrieve a custom widget for | ||
| * displaying the result. | ||
| * | ||
| * @param meta Result metadata | ||
| * @returns Custom widget or `null` for default rendering */ | ||
| createResultObject(meta: ResultMeta): Clutter.Actor | null; | ||
|
|
||
| /** Handles Shell's request to activate a search result. | ||
| * | ||
| * @param identifier Identifier of the activated result | ||
| * @param terms Search terms that led to this result */ | ||
| activateResult(identifier: string, terms: string[]): void; | ||
|
|
||
| /** Handles Shell's request to activate the "Show more results" action for | ||
| * current search terms. | ||
| * | ||
| * @param terms Current search terms */ | ||
| launchSearch(terms: string[]): void; | ||
| } | ||
|
|
||
|
|
||
| /** Search result metadata. | ||
| * | ||
| * Used by Shell to display search results. | ||
| * | ||
| * */ | ||
| export interface ResultMeta { | ||
|
|
||
| /** Unique identifier of the result */ | ||
| id: string; | ||
|
|
||
| /** Name for the result (title) */ | ||
| name: string; | ||
|
|
||
| /** Description of the result (optional). */ | ||
| description?: string; | ||
|
|
||
| /** Text to place in the clipboard when the result is activated (optional). */ | ||
| clipboardText?: string; | ||
|
|
||
| /** Callback function that returns an icon for the result at the specified size. */ | ||
| createIcon: (size: number) => Clutter.Actor; | ||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.