-
Notifications
You must be signed in to change notification settings - Fork 34
/
index.d.ts
62 lines (52 loc) · 1.64 KB
/
index.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
// TODO: contribute these types to @girs
interface ImportMeta {
url: string;
}
declare const global: any;
type MethodNames<T extends object> = {
[K in keyof T]: T[K] extends Function ? K : never;
}[keyof T];
declare module "resource:///org/gnome/shell/extensions/extension.js" {
type CreateOverrideFunc<
O extends object,
F extends (...args: any[]) => any,
> = (originalMethod: F) => (this: O, ...args: Parameters<F>) => ReturnType<F>;
export class InjectionManager {
/**
* Modify, replace or inject a method
*
* @param prototype - the object (or prototype) that is modified
* @param methodName - the name of the overwritten method
* @param createOverrideFunc - function to call to create the override
*/
overrideMethod<P extends object, MN extends MethodNames<P>>(
prototype: P,
methodName: MN,
// @ts-expect-error It works
createOverrideFunc: CreateOverrideFunc<P, P[MN]>,
): void;
/**
* Restore the original method
*
* @param prototype - the object (or prototype) that is modified
* @param methodName - the name of the method to restore
*/
restoreMethod(prototype: object, methodName: string): void;
/**
* Restore all original methods and clear overrides
*/
clear(): void;
_saveMethod(prototype: object, methodName: string): void;
_installMethod(
prototype: object,
methodName: string,
method: Function,
): void;
}
}
declare module "resource:///org/gnome/shell/ui/workspace.js" {
import type Meta from "gi://Meta";
export class Workspace {
_isOverviewWindow(window: Meta.Window): boolean;
}
}