wallpaper-engine 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers.cjs +119 -0
- package/dist/helpers.cjs.map +1 -0
- package/dist/helpers.d.cts +121 -0
- package/dist/helpers.d.ts +121 -0
- package/dist/helpers.js +86 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.cjs +39 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +529 -0
- package/dist/index.d.ts +529 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin/devtools/client.js +15900 -0
- package/dist/plugin/index.d.ts +334 -0
- package/dist/plugin/index.js +132 -0
- package/dist/plugin/index.js.map +1 -0
- package/package.json +70 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
/** File type accepted by file/directory properties */
|
|
2
|
+
type WallpaperFileType = "image" | "video";
|
|
3
|
+
/**
|
|
4
|
+
* Localization map inside `project.json`'s `general.localization`.
|
|
5
|
+
* Outer key: BCP-47 language code (e.g. `"en-us"`, `"de-de"`, `"zh-chs"`).
|
|
6
|
+
* Inner key: `ui_` token string. Value: translated display text.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* {
|
|
10
|
+
* "en-us": { "ui_mycolor": "Background color" },
|
|
11
|
+
* "de-de": { "ui_mycolor": "Hintergrundfarbe" }
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
type WallpaperLocalization = Record<string, Record<string, string>>;
|
|
15
|
+
interface WallpaperPropertyBase {
|
|
16
|
+
/** Display label shown in the properties panel, or a `ui_` token for localization */
|
|
17
|
+
text: string;
|
|
18
|
+
/** Sort index within the properties panel */
|
|
19
|
+
order?: number;
|
|
20
|
+
/** Internal sequential index (auto-assigned by the editor) */
|
|
21
|
+
index?: number;
|
|
22
|
+
/**
|
|
23
|
+
* JavaScript expression evaluated to determine visibility.
|
|
24
|
+
* References other property keys, e.g. `"showclock.value == true"`.
|
|
25
|
+
*/
|
|
26
|
+
condition?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Color picker property. Shows a color picker to the user.
|
|
30
|
+
* The runtime value is `"R G B"` where each channel is in the **0–1** range.
|
|
31
|
+
*/
|
|
32
|
+
interface WallpaperColorProperty extends WallpaperPropertyBase {
|
|
33
|
+
type: "color";
|
|
34
|
+
/** Default color as `"R G B"` with each channel in the 0–1 range. */
|
|
35
|
+
value: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Slider property. Lets users pick a number in a defined range.
|
|
39
|
+
* Enable `fraction` for decimal values; `precision` controls decimal places (default: `2`).
|
|
40
|
+
*/
|
|
41
|
+
interface WallpaperSliderProperty extends WallpaperPropertyBase {
|
|
42
|
+
type: "slider";
|
|
43
|
+
/** Default value — should be within `[min, max]`. */
|
|
44
|
+
value: number;
|
|
45
|
+
min: number;
|
|
46
|
+
max: number;
|
|
47
|
+
/** Allow fractional (decimal) values. */
|
|
48
|
+
fraction?: boolean;
|
|
49
|
+
/** Number of decimal places when `fraction` is `true` (default: `2`). */
|
|
50
|
+
precision?: number;
|
|
51
|
+
}
|
|
52
|
+
/** Checkbox (on/off toggle) property. */
|
|
53
|
+
interface WallpaperBoolProperty extends WallpaperPropertyBase {
|
|
54
|
+
type: "bool";
|
|
55
|
+
/** Default checked state. */
|
|
56
|
+
value: boolean;
|
|
57
|
+
}
|
|
58
|
+
interface WallpaperComboOption {
|
|
59
|
+
/** Human-readable label shown in the dropdown, or a `ui_` token */
|
|
60
|
+
label: string;
|
|
61
|
+
/** Hidden value passed to `applyUserProperties` */
|
|
62
|
+
value: string;
|
|
63
|
+
}
|
|
64
|
+
interface WallpaperComboProperty extends WallpaperPropertyBase {
|
|
65
|
+
type: "combo";
|
|
66
|
+
/** Key of the default selected option */
|
|
67
|
+
value: string;
|
|
68
|
+
options: WallpaperComboOption[];
|
|
69
|
+
}
|
|
70
|
+
/** Free-text input property. */
|
|
71
|
+
interface WallpaperTextInputProperty extends WallpaperPropertyBase {
|
|
72
|
+
type: "textinput";
|
|
73
|
+
/** Default text value. */
|
|
74
|
+
value: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* File selector property. Lets users import a single image or video file.
|
|
78
|
+
* The runtime `value` path must be prefixed with `"file:///"` before use as a URL.
|
|
79
|
+
*/
|
|
80
|
+
interface WallpaperFileProperty extends WallpaperPropertyBase {
|
|
81
|
+
type: "file";
|
|
82
|
+
/** Default file path (empty string = no file selected). */
|
|
83
|
+
value: string;
|
|
84
|
+
fileType?: WallpaperFileType;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Directory selector for mass-importing image or video files.
|
|
88
|
+
* Choose between `"ondemand"` (one random file at a time via
|
|
89
|
+
* `wallpaperRequestRandomFileForProperty`) and `"fetchall"` (all files
|
|
90
|
+
* surfaced via `userDirectoryFilesAddedOrChanged` / `userDirectoryFilesRemoved`).
|
|
91
|
+
*/
|
|
92
|
+
interface WallpaperDirectoryProperty extends WallpaperPropertyBase {
|
|
93
|
+
type: "directory";
|
|
94
|
+
/** Default directory path (empty string = no directory selected). */
|
|
95
|
+
value: string;
|
|
96
|
+
fileType?: WallpaperFileType;
|
|
97
|
+
/**
|
|
98
|
+
* - `"ondemand"` — call `wallpaperRequestRandomFileForProperty` to get a file.
|
|
99
|
+
* - `"fetchall"` — all files are surfaced via `userDirectoryFilesAddedOrChanged`.
|
|
100
|
+
*/
|
|
101
|
+
mode: "ondemand" | "fetchall";
|
|
102
|
+
}
|
|
103
|
+
/** Union of all property definition types stored in `project.json`. */
|
|
104
|
+
type WallpaperPropertyDefinition = WallpaperColorProperty | WallpaperSliderProperty | WallpaperBoolProperty | WallpaperComboProperty | WallpaperTextInputProperty | WallpaperFileProperty | WallpaperDirectoryProperty;
|
|
105
|
+
/** The `general` block inside `project.json`. */
|
|
106
|
+
interface WallpaperProjectGeneral {
|
|
107
|
+
properties?: Record<string, WallpaperPropertyDefinition>;
|
|
108
|
+
localization?: WallpaperLocalization;
|
|
109
|
+
}
|
|
110
|
+
/** Full shape of the `project.json` file generated by Wallpaper Engine */
|
|
111
|
+
interface WallpaperProject {
|
|
112
|
+
/** Entry HTML file name relative to the project directory */
|
|
113
|
+
file: string;
|
|
114
|
+
/** Wallpaper title shown in the Wallpaper Engine UI */
|
|
115
|
+
title: string;
|
|
116
|
+
type: "web";
|
|
117
|
+
/**
|
|
118
|
+
* Set to `true` to enable audio data delivery.
|
|
119
|
+
* Wallpaper Engine auto-detects this from `wallpaperRegisterAudioListener`
|
|
120
|
+
* calls, but you can also set it manually.
|
|
121
|
+
*/
|
|
122
|
+
supportsaudioprocessing?: boolean;
|
|
123
|
+
general?: WallpaperProjectGeneral;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Runtime value of a color property.
|
|
128
|
+
* `value` is `"R G B"` where each channel is in the **0–1** range.
|
|
129
|
+
* Multiply by 255 to convert for CSS `rgb()`.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* const [r, g, b] = props.myColor.value.split(' ').map(c => Math.ceil(+c * 255));
|
|
133
|
+
* el.style.color = `rgb(${r},${g},${b})`;
|
|
134
|
+
*/
|
|
135
|
+
interface WallpaperColorValue {
|
|
136
|
+
/** Color string `"R G B"` — each channel 0.0–1.0. */
|
|
137
|
+
value: string;
|
|
138
|
+
}
|
|
139
|
+
/** Runtime value of a slider property. */
|
|
140
|
+
interface WallpaperSliderValue {
|
|
141
|
+
value: number;
|
|
142
|
+
}
|
|
143
|
+
/** Runtime value of a checkbox (`bool`) property. */
|
|
144
|
+
interface WallpaperBoolValue {
|
|
145
|
+
value: boolean;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Runtime value of a combo (dropdown) property.
|
|
149
|
+
* `value` is the hidden key configured in the editor;
|
|
150
|
+
* `text` is the visible display label.
|
|
151
|
+
*/
|
|
152
|
+
interface WallpaperComboValue {
|
|
153
|
+
/** The hidden value configured on the combo option. */
|
|
154
|
+
value: string;
|
|
155
|
+
/** Display label of the selected option (may be a `ui_` localization token). */
|
|
156
|
+
text: string;
|
|
157
|
+
}
|
|
158
|
+
/** Runtime value of a text-input property. */
|
|
159
|
+
interface WallpaperTextValue {
|
|
160
|
+
value: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Runtime value of a file property.
|
|
164
|
+
* Prepend `"file:///"` to `value` before using it as a URL.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* img.src = 'file:///' + props.myImage.value;
|
|
168
|
+
*/
|
|
169
|
+
interface WallpaperFileValue {
|
|
170
|
+
/** File path — prepend `"file:///"` before use as a URL. */
|
|
171
|
+
value: string;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Runtime value of a directory property in `ondemand` mode.
|
|
175
|
+
* An empty string means no directory is currently selected.
|
|
176
|
+
* Call `wallpaperRequestRandomFileForProperty` to retrieve a random file.
|
|
177
|
+
*/
|
|
178
|
+
interface WallpaperDirectoryValue {
|
|
179
|
+
/** Directory path, or empty string when no directory is selected. */
|
|
180
|
+
value: string;
|
|
181
|
+
}
|
|
182
|
+
/** Union of all possible runtime property values delivered by `applyUserProperties`. */
|
|
183
|
+
type WallpaperPropertyRuntimeValue = WallpaperColorValue | WallpaperSliderValue | WallpaperBoolValue | WallpaperComboValue | WallpaperTextValue | WallpaperFileValue | WallpaperDirectoryValue;
|
|
184
|
+
/**
|
|
185
|
+
* Map of property key → current runtime value passed to
|
|
186
|
+
* `wallpaperPropertyListener.applyUserProperties`.
|
|
187
|
+
* On first load all properties are present; on subsequent calls only the
|
|
188
|
+
* changed ones are included — always guard with `if (properties.key)`.
|
|
189
|
+
*/
|
|
190
|
+
type WallpaperUserProperties = Record<string, WallpaperPropertyRuntimeValue>;
|
|
191
|
+
/** App-level settings delivered by `wallpaperPropertyListener.applyGeneralProperties`. */
|
|
192
|
+
interface WallpaperGeneralProperties {
|
|
193
|
+
/** Current FPS limit set by the user in Wallpaper Engine settings. `0` = unlimited. */
|
|
194
|
+
fps?: number;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Assign to `window.wallpaperPropertyListener` to receive property and
|
|
198
|
+
* app-settings updates. **Must be a top-level global** — never assign inside
|
|
199
|
+
* `window.onload` or other events, or startup events may be missed.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* window.wallpaperPropertyListener = {
|
|
203
|
+
* applyUserProperties(properties) {
|
|
204
|
+
* if (properties.mycolor) { ... }
|
|
205
|
+
* },
|
|
206
|
+
* };
|
|
207
|
+
*/
|
|
208
|
+
interface WallpaperPropertyListener {
|
|
209
|
+
/**
|
|
210
|
+
* Called once on wallpaper load (with all user properties) and again
|
|
211
|
+
* whenever the user changes a property. Only changed properties are
|
|
212
|
+
* included on subsequent calls — always guard with `if (properties.key)`.
|
|
213
|
+
*/
|
|
214
|
+
applyUserProperties?: (properties: WallpaperUserProperties) => void;
|
|
215
|
+
/**
|
|
216
|
+
* Called on load and whenever the user changes app-level settings
|
|
217
|
+
* such as the FPS limit. See {@link WallpaperGeneralProperties}.
|
|
218
|
+
*/
|
|
219
|
+
applyGeneralProperties?: (properties: WallpaperGeneralProperties) => void;
|
|
220
|
+
/**
|
|
221
|
+
* Called for `directory` properties in `fetchall` mode when files are
|
|
222
|
+
* added or modified in the selected directory. Prepend `"file:///"` to
|
|
223
|
+
* each path before using it as a URL.
|
|
224
|
+
*/
|
|
225
|
+
userDirectoryFilesAddedOrChanged?: (propertyName: string, changedFiles: string[]) => void;
|
|
226
|
+
/**
|
|
227
|
+
* Called for `directory` properties in `fetchall` mode when files are
|
|
228
|
+
* removed from the selected directory.
|
|
229
|
+
*/
|
|
230
|
+
userDirectoryFilesRemoved?: (propertyName: string, removedFiles: string[]) => void;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Assign to `window.wallpaperPluginListener` to detect when RGB plugins load.
|
|
234
|
+
* Check `name` to distinguish `"led"` (all RGB hardware via `wpPlugins.led`)
|
|
235
|
+
* from `"cue"` (Corsair iCUE direct SDK, only needed for advanced features).
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* window.wallpaperPluginListener = {
|
|
239
|
+
* onPluginLoaded(name, version) {
|
|
240
|
+
* if (name === 'led') { // general RGB hardware ready
|
|
241
|
+
* }
|
|
242
|
+
* if (name === 'cue') { // Corsair iCUE SDK ready
|
|
243
|
+
* }
|
|
244
|
+
* },
|
|
245
|
+
* };
|
|
246
|
+
*/
|
|
247
|
+
interface WallpaperPluginListener {
|
|
248
|
+
/**
|
|
249
|
+
* Fired when a plugin finishes loading.
|
|
250
|
+
* @param name - `"led"` for general RGB hardware or `"cue"` for Corsair iCUE.
|
|
251
|
+
* @param version - Plugin version string.
|
|
252
|
+
*/
|
|
253
|
+
onPluginLoaded?: (name: string, version: string) => void;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Event fired by `wallpaperRegisterMediaStatusListener` when the user enables
|
|
257
|
+
* or disables media integration in the Wallpaper Engine app settings.
|
|
258
|
+
*/
|
|
259
|
+
interface WallpaperMediaStatusEvent {
|
|
260
|
+
/** `true` when media integration is active; `false` when disabled. */
|
|
261
|
+
enabled: boolean;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Event fired by `wallpaperRegisterMediaPropertiesListener` when the
|
|
265
|
+
* currently playing track's metadata changes (title, artist, album, etc.).
|
|
266
|
+
*/
|
|
267
|
+
interface WallpaperMediaPropertiesEvent {
|
|
268
|
+
/** Title of the currently playing media. */
|
|
269
|
+
title: string;
|
|
270
|
+
/** Artist of the currently playing media. */
|
|
271
|
+
artist: string;
|
|
272
|
+
/** Optional sub-title (e.g. episode name for podcasts). */
|
|
273
|
+
subTitle?: string;
|
|
274
|
+
/** Optional album title. */
|
|
275
|
+
albumTitle?: string;
|
|
276
|
+
/** Optional album artist (may differ from `artist`). */
|
|
277
|
+
albumArtist?: string;
|
|
278
|
+
/** Optional comma-separated list of genres. */
|
|
279
|
+
genres?: string;
|
|
280
|
+
/** Media type: `"music"`, `"video"`, or `"image"`. */
|
|
281
|
+
contentType: "music" | "video" | "image";
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Event fired by `wallpaperRegisterMediaThumbnailListener` when album art changes.
|
|
285
|
+
* Assign `event.thumbnail` directly to `img.src`.
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* window.wallpaperRegisterMediaThumbnailListener((e) => {
|
|
289
|
+
* document.getElementById('cover').src = e.thumbnail;
|
|
290
|
+
* document.body.style.background = e.primaryColor;
|
|
291
|
+
* titleEl.style.color = e.textColor;
|
|
292
|
+
* });
|
|
293
|
+
*/
|
|
294
|
+
interface WallpaperMediaThumbnailEvent {
|
|
295
|
+
/** Base64-encoded PNG of the album art — usable directly as `img.src`. */
|
|
296
|
+
thumbnail: string;
|
|
297
|
+
/** Dominant color extracted from the thumbnail. */
|
|
298
|
+
primaryColor: string;
|
|
299
|
+
/** Secondary color from the thumbnail palette. */
|
|
300
|
+
secondaryColor: string;
|
|
301
|
+
/** Tertiary color from the thumbnail palette. */
|
|
302
|
+
tertiaryColor: string;
|
|
303
|
+
/**
|
|
304
|
+
* Text color guaranteed to contrast sufficiently against `primaryColor`.
|
|
305
|
+
* May be `secondaryColor` or `tertiaryColor` when the contrast is sufficient.
|
|
306
|
+
*/
|
|
307
|
+
textColor: string;
|
|
308
|
+
/** Either black or white — whichever contrasts more against `primaryColor`. */
|
|
309
|
+
highContrastColor: string;
|
|
310
|
+
}
|
|
311
|
+
/** Media is actively playing on the system. */
|
|
312
|
+
declare const PLAYBACK_PLAYING: 0;
|
|
313
|
+
/** Media was playing but has been temporarily paused by the user. */
|
|
314
|
+
declare const PLAYBACK_PAUSED: 1;
|
|
315
|
+
/** Media playback is completely stopped. */
|
|
316
|
+
declare const PLAYBACK_STOPPED: 2;
|
|
317
|
+
/**
|
|
318
|
+
* Numeric playback state for {@link WallpaperMediaPlaybackEvent}.
|
|
319
|
+
* Compare against `window.wallpaperMediaIntegration.PLAYBACK_PLAYING` etc.
|
|
320
|
+
* or the module-level constants {@link PLAYBACK_PLAYING}, {@link PLAYBACK_PAUSED},
|
|
321
|
+
* {@link PLAYBACK_STOPPED}.
|
|
322
|
+
*/
|
|
323
|
+
type WallpaperMediaPlaybackState = typeof PLAYBACK_PLAYING | typeof PLAYBACK_PAUSED | typeof PLAYBACK_STOPPED;
|
|
324
|
+
/**
|
|
325
|
+
* Event fired by `wallpaperRegisterMediaPlaybackListener` when playback
|
|
326
|
+
* starts, pauses, or stops.
|
|
327
|
+
*/
|
|
328
|
+
interface WallpaperMediaPlaybackEvent {
|
|
329
|
+
/**
|
|
330
|
+
* Current playback state. Compare against the `PLAYBACK_*` constants:
|
|
331
|
+
* - `PLAYBACK_PLAYING` (`0`) — actively playing
|
|
332
|
+
* - `PLAYBACK_PAUSED` (`1`) — temporarily paused
|
|
333
|
+
* - `PLAYBACK_STOPPED` (`2`) — playback stopped
|
|
334
|
+
*/
|
|
335
|
+
state: WallpaperMediaPlaybackState;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Event fired by `wallpaperRegisterMediaTimelineListener` when track position
|
|
339
|
+
* changes. **Not all media players support this** — ensure your wallpaper
|
|
340
|
+
* works correctly even if this listener is never called.
|
|
341
|
+
*/
|
|
342
|
+
interface WallpaperMediaTimelineEvent {
|
|
343
|
+
/** Current playback position in seconds. */
|
|
344
|
+
position: number;
|
|
345
|
+
/** Total track duration in seconds. */
|
|
346
|
+
duration: number;
|
|
347
|
+
}
|
|
348
|
+
/** Returned by `window.cue.getProtocolDetails` */
|
|
349
|
+
interface CueProtocolDetails {
|
|
350
|
+
sdkVersion: string;
|
|
351
|
+
serverVersion: string;
|
|
352
|
+
sdkProtocolVersion: number;
|
|
353
|
+
serverProtocolVersion: number;
|
|
354
|
+
breakingChanges: boolean;
|
|
355
|
+
}
|
|
356
|
+
/** Returned by `window.cue.getDeviceInfo` — mirrors `CorsairDeviceInfo` in the C++ SDK */
|
|
357
|
+
interface CueDeviceInfo {
|
|
358
|
+
/** `CorsairDeviceType` enum value */
|
|
359
|
+
type: number;
|
|
360
|
+
/** Human-readable device model name */
|
|
361
|
+
model: string;
|
|
362
|
+
/** `CorsairPhysicalLayout` enum value */
|
|
363
|
+
physicalLayout: number;
|
|
364
|
+
/** `CorsairLogicalLayout` enum value */
|
|
365
|
+
logicalLayout: number;
|
|
366
|
+
/** Number of available LEDs on this device */
|
|
367
|
+
ledCount: number;
|
|
368
|
+
/** `CorsairDeviceCaps` bitmask */
|
|
369
|
+
capsMask: number;
|
|
370
|
+
}
|
|
371
|
+
/** An entry in the array returned by `window.cue.getLedPositionsByDeviceIndex` */
|
|
372
|
+
interface CueLedPosition {
|
|
373
|
+
/** `CorsairLedId` as integer */
|
|
374
|
+
ledId: number;
|
|
375
|
+
/** `CorsairLedId` as string */
|
|
376
|
+
ledIdName: string;
|
|
377
|
+
/** Position in mm from the top of the device */
|
|
378
|
+
top: number;
|
|
379
|
+
/** Position in mm from the left of the device */
|
|
380
|
+
left: number;
|
|
381
|
+
width: number;
|
|
382
|
+
height: number;
|
|
383
|
+
}
|
|
384
|
+
/** LED color entry used in `setLedsColorsAsync` / `setAllLedsColorsAsync` */
|
|
385
|
+
interface CueLedColor {
|
|
386
|
+
/** `CorsairLedId` as integer */
|
|
387
|
+
ledId: number;
|
|
388
|
+
r: number;
|
|
389
|
+
g: number;
|
|
390
|
+
b: number;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Direct Corsair iCUE SDK access exposed as `window.cue`.
|
|
394
|
+
* Only available after the `"cue"` plugin has loaded via `wallpaperPluginListener`.
|
|
395
|
+
*/
|
|
396
|
+
interface WallpaperCuePlugin {
|
|
397
|
+
/** Returns current iCUE SDK status and version info */
|
|
398
|
+
getProtocolDetails(callback: (protocolDetails: CueProtocolDetails) => void): void;
|
|
399
|
+
/** Returns the number of recognised iCUE-compatible devices */
|
|
400
|
+
getDeviceCount(callback: (deviceCount: number) => void): void;
|
|
401
|
+
/** Returns hardware details for a specific device by index */
|
|
402
|
+
getDeviceInfo(deviceIndex: number, callback: (deviceInfo: CueDeviceInfo) => void): void;
|
|
403
|
+
/** Returns all LED positions for a specific device */
|
|
404
|
+
getLedPositionsByDeviceIndex(callback: (arrayOfLEDs: CueLedPosition[]) => void): void;
|
|
405
|
+
/** Update specific LEDs by supplying an array of `CueLedColor` objects */
|
|
406
|
+
setLedsColorsAsync(arrayOfLEDColors: CueLedColor[]): void;
|
|
407
|
+
/** Set all LEDs on one or more devices to a single color */
|
|
408
|
+
setAllLedsColorsAsync(deviceIndexOrArray: number | number[], LEDColor: CueLedColor): void;
|
|
409
|
+
/**
|
|
410
|
+
* Update device LEDs from an RGB bitmap string (same format as
|
|
411
|
+
* `wpPlugins.led.setAllDevicesByImageData`, but targets specific devices).
|
|
412
|
+
*/
|
|
413
|
+
setLedColorsByImageData(deviceIndexOrArray: number | number[], encodedImageData: string, width: number, height: number): void;
|
|
414
|
+
}
|
|
415
|
+
interface WallpaperLedPlugin {
|
|
416
|
+
/**
|
|
417
|
+
* Push concatenated RGB bytes (as a string) to all connected LED devices.
|
|
418
|
+
* Use a small canvas (e.g. 100×20) and convert it with `getImageData` for
|
|
419
|
+
* best performance.
|
|
420
|
+
*/
|
|
421
|
+
setAllDevicesByImageData(encodedImageData: string, width: number, height: number): void;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
declare global {
|
|
425
|
+
interface Window {
|
|
426
|
+
/**
|
|
427
|
+
* Assign this object to receive property change events.
|
|
428
|
+
* Must be set as a global — not inside `window.onload` or similar events.
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
* window.wallpaperPropertyListener = {
|
|
432
|
+
* applyUserProperties(properties) {
|
|
433
|
+
* if (properties.mycolor) { ... }
|
|
434
|
+
* },
|
|
435
|
+
* };
|
|
436
|
+
*/
|
|
437
|
+
wallpaperPropertyListener?: WallpaperPropertyListener;
|
|
438
|
+
/**
|
|
439
|
+
* Register a callback that receives 128 audio volume samples (~30 fps).
|
|
440
|
+
* - Indices 0–63: left channel (bass → treble)
|
|
441
|
+
* - Indices 64–127: right channel (bass → treble)
|
|
442
|
+
* Each value is 0.0–1.0 (may occasionally exceed 1.0 — clamp with `Math.min`).
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* window.wallpaperRegisterAudioListener((audioArray) => { ... });
|
|
446
|
+
*/
|
|
447
|
+
wallpaperRegisterAudioListener(callback: (audioArray: number[]) => void): void;
|
|
448
|
+
/**
|
|
449
|
+
* Request a random file path from an `ondemand` directory property.
|
|
450
|
+
*
|
|
451
|
+
* @param propertyName - The key of the directory property.
|
|
452
|
+
* @param callback - Receives the property name and the file path.
|
|
453
|
+
* Prepend `"file:///"` to the path before using it as a URL.
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* window.wallpaperRequestRandomFileForProperty('mybg', (name, filePath) => {
|
|
457
|
+
* img.src = 'file:///' + filePath;
|
|
458
|
+
* });
|
|
459
|
+
*/
|
|
460
|
+
wallpaperRequestRandomFileForProperty(propertyName: string, callback: (propertyName: string, filePath: string) => void): void;
|
|
461
|
+
/**
|
|
462
|
+
* Assign this object to detect when plugins (LED, CUE) are loaded.
|
|
463
|
+
* Check `name === "led"` or `name === "cue"` inside `onPluginLoaded`.
|
|
464
|
+
*/
|
|
465
|
+
wallpaperPluginListener?: WallpaperPluginListener;
|
|
466
|
+
/**
|
|
467
|
+
* Provides access to LED and iCUE plugin APIs after the respective plugin
|
|
468
|
+
* has loaded (see `wallpaperPluginListener`).
|
|
469
|
+
*/
|
|
470
|
+
wpPlugins: {
|
|
471
|
+
led: WallpaperLedPlugin;
|
|
472
|
+
};
|
|
473
|
+
/**
|
|
474
|
+
* Fired when the user enables/disables media integration in app settings.
|
|
475
|
+
* Register at the bottom of `<body>`, not inside `window.onload`.
|
|
476
|
+
*/
|
|
477
|
+
wallpaperRegisterMediaStatusListener(callback: (event: WallpaperMediaStatusEvent) => void): void;
|
|
478
|
+
/**
|
|
479
|
+
* Fired when track title, artist, album, or content type changes.
|
|
480
|
+
*/
|
|
481
|
+
wallpaperRegisterMediaPropertiesListener(callback: (event: WallpaperMediaPropertiesEvent) => void): void;
|
|
482
|
+
/**
|
|
483
|
+
* Fired when the album art thumbnail changes.
|
|
484
|
+
* `event.thumbnail` is a base64 PNG string usable as `img.src`.
|
|
485
|
+
*/
|
|
486
|
+
wallpaperRegisterMediaThumbnailListener(callback: (event: WallpaperMediaThumbnailEvent) => void): void;
|
|
487
|
+
/**
|
|
488
|
+
* Fired when playback starts, pauses, or stops.
|
|
489
|
+
* Compare `event.state` against `window.wallpaperMediaIntegration` constants.
|
|
490
|
+
*/
|
|
491
|
+
wallpaperRegisterMediaPlaybackListener(callback: (event: WallpaperMediaPlaybackEvent) => void): void;
|
|
492
|
+
/**
|
|
493
|
+
* Fired when the track position changes.
|
|
494
|
+
* Not all media players support this — ensure your wallpaper works without it.
|
|
495
|
+
*/
|
|
496
|
+
wallpaperRegisterMediaTimelineListener(callback: (event: WallpaperMediaTimelineEvent) => void): void;
|
|
497
|
+
/** Playback state constants for use with `WallpaperMediaPlaybackEvent.state` */
|
|
498
|
+
wallpaperMediaIntegration: {
|
|
499
|
+
PLAYBACK_PLAYING: WallpaperMediaPlaybackState;
|
|
500
|
+
PLAYBACK_PAUSED: WallpaperMediaPlaybackState;
|
|
501
|
+
PLAYBACK_STOPPED: WallpaperMediaPlaybackState;
|
|
502
|
+
};
|
|
503
|
+
/**
|
|
504
|
+
* Direct Corsair iCUE SDK access. Only available when the `"cue"` plugin
|
|
505
|
+
* has loaded (check via `wallpaperPluginListener.onPluginLoaded`).
|
|
506
|
+
*/
|
|
507
|
+
cue: WallpaperCuePlugin;
|
|
508
|
+
}
|
|
509
|
+
var wallpaperPropertyListener: WallpaperPropertyListener | undefined;
|
|
510
|
+
var wallpaperPluginListener: WallpaperPluginListener | undefined;
|
|
511
|
+
var wpPlugins: {
|
|
512
|
+
led: WallpaperLedPlugin;
|
|
513
|
+
};
|
|
514
|
+
var wallpaperMediaIntegration: {
|
|
515
|
+
PLAYBACK_PLAYING: WallpaperMediaPlaybackState;
|
|
516
|
+
PLAYBACK_PAUSED: WallpaperMediaPlaybackState;
|
|
517
|
+
PLAYBACK_STOPPED: WallpaperMediaPlaybackState;
|
|
518
|
+
};
|
|
519
|
+
var cue: WallpaperCuePlugin;
|
|
520
|
+
function wallpaperRegisterAudioListener(callback: (audioArray: number[]) => void): void;
|
|
521
|
+
function wallpaperRequestRandomFileForProperty(propertyName: string, callback: (propertyName: string, filePath: string) => void): void;
|
|
522
|
+
function wallpaperRegisterMediaStatusListener(callback: (event: WallpaperMediaStatusEvent) => void): void;
|
|
523
|
+
function wallpaperRegisterMediaPropertiesListener(callback: (event: WallpaperMediaPropertiesEvent) => void): void;
|
|
524
|
+
function wallpaperRegisterMediaThumbnailListener(callback: (event: WallpaperMediaThumbnailEvent) => void): void;
|
|
525
|
+
function wallpaperRegisterMediaPlaybackListener(callback: (event: WallpaperMediaPlaybackEvent) => void): void;
|
|
526
|
+
function wallpaperRegisterMediaTimelineListener(callback: (event: WallpaperMediaTimelineEvent) => void): void;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export { type CueDeviceInfo, type CueLedColor, type CueLedPosition, type CueProtocolDetails, PLAYBACK_PAUSED, PLAYBACK_PLAYING, PLAYBACK_STOPPED, type WallpaperBoolProperty, type WallpaperBoolValue, type WallpaperColorProperty, type WallpaperColorValue, type WallpaperComboOption, type WallpaperComboProperty, type WallpaperComboValue, type WallpaperCuePlugin, type WallpaperDirectoryProperty, type WallpaperDirectoryValue, type WallpaperFileProperty, type WallpaperFileType, type WallpaperFileValue, type WallpaperGeneralProperties, type WallpaperLedPlugin, type WallpaperLocalization, type WallpaperMediaPlaybackEvent, type WallpaperMediaPlaybackState, type WallpaperMediaPropertiesEvent, type WallpaperMediaStatusEvent, type WallpaperMediaThumbnailEvent, type WallpaperMediaTimelineEvent, type WallpaperPluginListener, type WallpaperProject, type WallpaperProjectGeneral, type WallpaperPropertyDefinition, type WallpaperPropertyListener, type WallpaperPropertyRuntimeValue, type WallpaperSliderProperty, type WallpaperSliderValue, type WallpaperTextInputProperty, type WallpaperTextValue, type WallpaperUserProperties };
|