-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
types.d.ts
101 lines (88 loc) · 2.61 KB
/
types.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
96
97
98
99
100
101
type DisplayType = 'laptop_monitor' | 'external_monitor' | 'unknown_monitor';
type Command =
// reset
| 'command/reset'
// brightness commands
| 'command/changeBrightness/down'
| 'command/changeBrightness/up'
| 'command/changeBrightness/0'
| 'command/changeBrightness/5'
| 'command/changeBrightness/10'
| 'command/changeBrightness/50'
| 'command/changeBrightness/100'
// volumes commands
| 'command/changeVolume/0'
| 'command/changeVolume/50'
| 'command/changeVolume/100'
// dark mode commands
| 'command/changeDarkMode/toggle'
| 'command/changeDarkMode/dark'
| 'command/changeDarkMode/light'
// open external links or text files
| 'command/openExternal/file/monitorConfigs'
| 'command/openExternal/file/preferences'
| 'command/openExternal/file/devLogs'
| 'command/openExternal/link/bugReport'
| 'command/openExternal/link/aboutUs'
| string;
type BrightnessPreset = {
// TODO: this is not supported, preset will apply to all monitors...
// which?: string;
/**
* whether or not this brightness preset will be associated with the dark or light mode
*/
syncedWithMode?: 'light' | 'dark';
level: number;
};
type VolumePreset = {
level: number;
};
type KeyBinding = {
key: string;
command: Command[] | Command;
notification?: string;
};
export type SingleMonitorUpdateInput = {
id: string;
name?: string;
brightness?: number;
disabled?: boolean;
sortOrder?: number;
type?: DisplayType;
};
export type BatchMonitorUpdateInput = {
brightness?: number;
};
export type Monitor = Required<SingleMonitorUpdateInput>;
export type VolumeInput = {
muted?: boolean;
value?: number;
};
export type Volume = Required<VolumeInput> & { isDisabled?: boolean };
export type AppConfig = {
monitors: Monitor[];
darkMode: boolean;
volume: Volume;
env: string;
version: string;
platform: 'win32' | 'darwin';
};
export type IDisplayAdapter = {
getMonitorList: () => Promise<string[]>;
getMonitorType: (targetMonitorId: string) => Promise<DisplayType>;
getMonitorBrightness: (targetMonitorId: string) => Promise<number>;
updateMonitorBrightness: (targetMonitorId: string, newBrightness: number) => Promise<void>;
batchUpdateMonitorBrightness: (monitors: Monitor[]) => Promise<void>;
getDarkMode: () => Promise<boolean>;
updateDarkMode: (isDarkModeOn: boolean) => Promise<void>;
};
export type Preference = {
mode?: 'win32' | 'm1_mac' | 'intel_mac';
showIndividualDisplays: boolean;
logging: boolean;
brightnessDelta: number;
brightnessPresets: BrightnessPreset[];
volumePresets: VolumePreset[];
keyBindings: KeyBinding[];
};
export type UIAppState = {};