-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
gnome.d.ts
95 lines (86 loc) · 2.65 KB
/
gnome.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import "@girs/gjs";
import "@girs/gjs/dom";
import "@girs/gnome-shell/ambient";
import "@girs/gnome-shell/extensions/global";
import { AppSearchProvider } from "resource:///org/gnome/shell/ui/appDisplay.js";
import {
Extension,
ExtensionMetadata,
} from "resource:///org/gnome/shell/extensions/extension.js";
declare module "resource:///org/gnome/shell/ui/main.js" {
export module overview {
export module searchController {
export function addProvider(provider: AppSearchProvider): void;
export function removeProvider(provider: AppSearchProvider): void;
}
}
}
declare module "resource:///org/gnome/shell/extensions/extension.gg" {
export class Extension {
constructor(metadata: ExtensionMetadata);
enable(): void;
disable(): void;
get uuid(): string;
get application(): Shell.App | null;
}
}
declare module "resource:///org/gnome/shell/ui/appDisplay.js" {
export interface ResultMeta {
id: string;
name: string;
description?: string;
createIcon: (size: number) => unknown;
}
export class AppSearchProvider {
constructor(extension: Extension);
/**
* Launch the search result.
*/
activateResult(result: string, terms: string[]): void;
/**
* Get result metadata.
*/
getResultMetas(
results: string[],
cancellable: Gio.Cancellable,
): Promise<ResultMeta[]>;
/**
* Initiate a new search.
*
* This method is called to start a new search and should return a list of
* unique identifiers for the results.
*
* If cancellable is triggered, this method should throw an error.
*/
getInitialResultSet(
terms: string[],
cancellable: Gio.Cancellable,
): Promise<string[]>;
/**
* Refine the current search.
*
* This method is called to refine the current search results with
* expanded terms and should return a subset of the original result set.
*
* Implementations may use this method to refine the search results more
* efficiently than running a new search, or simply pass the terms to the
* implementation of `getInitialResultSet()`.
*
* If cancellable is triggered, this method should throw an error.
*/
getSubsearchResultSet(
results: string[],
terms: string[],
cancellable: Gio.Cancellable,
): Promise<string[]>;
/**
* Filter the current search.
*
* This method is called to truncate the number of search results.
*
* Implementations may use their own criteria for discarding results, or
* simply return the first n-items.
*/
filterResults(results: string[], maxResults: number): string[];
}
}