### Example Manifest Source: https://docs.elgato.com/icue/widgets/specification A complete manifest.json example showing required and optional properties, including supported devices and required plugins. ```json { "author": "Corsair Team", "id": "com.corsair.weatherwidget", "name": "Weather Widget", "description": "Display current weather and forecast", "version": "1.0.0", "preview_icon": "resources/icon.png", "min_app_version": "5.46", "min_framework_version": "1.0.0", "os": [ { "platform": "windows" } ], "supported_devices": [ { "type": "dashboard_lcd", "features": ["sensor-screen"] }, { "type": "pump_lcd" }, { "type": "keyboard_lcd" } ], "interactive": true, "required_plugins": [ "widgetbuilder.sensorsdataprovider:Sensors:1.0", "widgetbuilder.mediadataprovider:Media:1.0" ], "modules": [ "modules/CitySearch.mjs" ] } ``` -------------------------------- ### Example: manifest.json and index.html for DeviceAction Source: https://docs.elgato.com/icue/widgets/references/plugins/device-action-provider Complete example showing the manifest entry and the JavaScript code to initialize the plugin and connect to the dialTriggered signal. ```json "required_plugins": [ "widgetbuilder.deviceactionprovider:DeviceAction:1.0" ] ``` ```javascript function onDialTriggered(actionType, dialIndex) { console.log("Action:", actionType, "Dial:", dialIndex); } pluginDeviceactionproviderEvents = { "onInitialized": function () { if (!window.plugins || !window.plugins.Deviceactionprovider) { return; } window.plugins.Deviceactionprovider.initDevice(device.deviceId); window.plugins.Deviceactionprovider.dialTriggered.connect(onDialTriggered); } }; if (typeof pluginDeviceactionprovider_initialized !== "undefined" && pluginDeviceactionprovider_initialized) { pluginDeviceactionproviderEvents.onInitialized(); } ``` -------------------------------- ### Complete widget HTML example Source: https://docs.elgato.com/icue/widgets/references/controls/sensors-combobox Full HTML document for the complete widget example. It includes the meta property for sensors-combobox, groups definition, script includes for IcueWidgetApiWrapper and SimpleSensorApiWrapper, and JavaScript to display sensor values. Requires icon.svg and the common folder from the iCUE installation. ```html 'Sensors Combobox Demo'
--
``` -------------------------------- ### Complete widget example - manifest Source: https://docs.elgato.com/icue/widgets/references/controls/media-selector Manifest file for a complete media-selector widget example, specifying author, ID, name, supported OS, and devices. ```json { "author": "Corsair Team", "id": "com.corsair.mediaselectordemo", "name": "Media Selector Demo", "description": "Media Selector Demo", "version": "1.0.0", "preview_icon": "icon.png", "min_framework_version": "1.0.0", "os": [ { "platform": "windows" }, { "platform": "mac" } ], "supported_devices": [ { "type": "dashboard_lcd", "features": ["sensor-screen"] }, { "type": "pump_lcd" }, { "type": "keyboard_lcd" } ] } ``` -------------------------------- ### Complete widget example - HTML Source: https://docs.elgato.com/icue/widgets/references/controls/media-selector HTML file for the complete media-selector widget example, including the meta tag, MediaViewer integration, and update logic. ```html 'Media Selector Demo'
No media
``` -------------------------------- ### Example: manifest.json and index.html for Media Data Provider Source: https://docs.elgato.com/icue/widgets/references/plugins/media-data-provider Complete example showing the manifest entry and usage in index.html. The JavaScript initializes the wrapper, fetches song name and artist asynchronously, and demonstrates synchronous playback controls. ```json "required_plugins": [ "widgetbuilder.mediadataprovider:Media:1.0" ] ``` ```javascript // After including IcueWidgetApiWrapper and SimpleMediaApiWrapper in : const mediaApi = new SimpleMediaApiWrapper(window.plugins.Mediadataprovider); async function displayCurrentTrack() { const [songName, artist] = await Promise.all([ mediaApi.getSongName(), mediaApi.getArtist(), ]); console.log(`Now playing: ${songName} by ${artist}`); } // Playback controls (synchronous — call directly on the plugin) window.plugins.Mediadataprovider.triggerPlayPause(); window.plugins.Mediadataprovider.triggerNextTrack(); window.plugins.Mediadataprovider.triggerPreviousTrack(); ``` -------------------------------- ### Complete widget example - Manifest Source: https://docs.elgato.com/icue/widgets/references/controls/switch Manifest file for a complete switch widget example. It defines the widget metadata, supported platforms, and devices. ```json { "author": "Corsair Team", "id": "com.corsair.switchdemo", "name": "Switch Demo", "description": "Switch Demo", "version": "1.0.0", "preview_icon": "icon.png", "min_framework_version": "1.0.0", "os": [ { "platform": "windows" }, { "platform": "mac" } ], "supported_devices": [ { "type": "dashboard_lcd", "features": ["sensor-screen"] }, { "type": "pump_lcd" }, { "type": "keyboard_lcd" } ] } ``` -------------------------------- ### Example: display all sensors with SimpleSensorApiWrapper Source: https://docs.elgato.com/icue/widgets/references/plugins/sensors-data-provider After including IcueWidgetApiWrapper and SimpleSensorApiWrapper in the , this example creates a wrapper instance and asynchronously logs the name, value, and units for every sensor. It uses Promise.all to fetch sensor data concurrently. ```javascript // After including IcueWidgetApiWrapper and SimpleSensorApiWrapper in : const sensorApi = new SimpleSensorApiWrapper(window.plugins.Sensorsdataprovider); async function displayAllSensors() { const sensorIds = await sensorApi.getAllSensorIds(); for (const sensorId of sensorIds) { const [name, value, units] = await Promise.all([ sensorApi.getSensorName(sensorId), sensorApi.getSensorValue(sensorId), sensorApi.getSensorUnits(sensorId), ]); console.log(`${name}: ${value} ${units}`); } } displayAllSensors(); ``` -------------------------------- ### Device Support Example Source: https://docs.elgato.com/icue/widgets/specification Shows how to specify supported devices with optional feature requirements in the manifest. ```json "supported_devices": [ { "type": "dashboard_lcd", "features": ["sensor-screen"] }, { "type": "pump_lcd" } ] ``` -------------------------------- ### Complete widget example - HTML Source: https://docs.elgato.com/icue/widgets/references/controls/switch HTML file for a complete switch widget example. It includes the switch meta tag, a group definition, and JavaScript to update the display based on the switch value. ```html 'Switch Demo'
ON
``` -------------------------------- ### Complete Widget Example - Manifest Source: https://docs.elgato.com/icue/widgets/references/controls/combobox Manifest file for a complete combobox widget example. It defines the widget metadata, supported OS, and supported devices. ```json { "author": "Corsair Team", "id": "com.corsair.comboboxdemo", "name": "Combobox Demo", "description": "Combobox Demo", "version": "1.0.0", "preview_icon": "icon.png", "min_framework_version": "1.0.0", "os": [ { "platform": "windows" }, { "platform": "mac" } ], "supported_devices": [ { "type": "dashboard_lcd", "features": ["sensor-screen"] }, { "type": "pump_lcd" }, { "type": "keyboard_lcd" } ] } ``` -------------------------------- ### Install iCUE Widget CLI with npm Source: https://docs.elgato.com/icue/widgets Install the iCUE Widget CLI globally as an npm package. After installation, the `icuewidget` command becomes available in the terminal. ```bash npm install -g icuewidget-cli ``` -------------------------------- ### SimpleFpsApiWrapper usage example with manifest.json and index.html Source: https://docs.elgato.com/icue/widgets/references/plugins/fps-data-provider Complete example showing the manifest entry and the HTML/JavaScript code to fetch FPS data and process name using the wrapper. The manifest.json declares the required plugin, and index.html uses the wrapper to display FPS data. ```json "required_plugins": [ "widgetbuilder.fpsdataprovider:Fps:1.0" ] ``` ```javascript // After including IcueWidgetApiWrapper and SimpleFpsApiWrapper in : const fpsApi = new SimpleFpsApiWrapper(window.plugins.Fpsdataprovider); async function displayFpsData() { const available = await fpsApi.getFpsAvailable(); if (available) { const [fps, process] = await Promise.all([ fpsApi.getCurrentFps(), fpsApi.getCurrentProcess() ]); console.log(`${process}: ${fps} FPS`); } } displayFpsData(); ``` -------------------------------- ### Manifest required_plugins declaration (Example section) Source: https://docs.elgato.com/icue/widgets/references/controls/sensors-combobox Shows the required_plugins entry in the manifest as part of the example. This is the same plugin declaration as in the Requirements section. ```json "required_plugins": [ "widgetbuilder.sensorsdataprovider:Sensors:1.0" ] ``` -------------------------------- ### JavaScript usage example for sensorId Source: https://docs.elgato.com/icue/widgets/references/controls/sensors-combobox Shows how to access the selected sensor ID in JavaScript. The example logs 'cpu_temp_0' as a sample output. ```javascript console.log(sensorId); // "cpu_temp_0" ``` -------------------------------- ### Complete example: index.html Source: https://docs.elgato.com/icue/widgets/references/translations A complete HTML file using tr() in meta properties and groups, with a simple body. ```html tr('Clock')
``` -------------------------------- ### Complete Widget Example - HTML Source: https://docs.elgato.com/icue/widgets/references/controls/combobox HTML file for the complete combobox widget example. It includes the combobox meta tag, a group definition, and JavaScript to update the display based on the selected value. ```html 'Combobox Demo'
apple
``` -------------------------------- ### Complete Widget Example - Manifest Source: https://docs.elgato.com/icue/widgets/references/controls/textfield Manifest JSON for a complete textfield widget example. It defines the widget metadata, supported OS (Windows and Mac), and supported devices (dashboard_lcd, pump_lcd, keyboard_lcd). ```json { "author": "Corsair Team", "id": "com.corsair.textfielddemo", "name": "Textfield Demo", "description": "Textfield Demo", "version": "1.0.0", "preview_icon": "icon.png", "min_framework_version": "1.0.0", "os": [ { "platform": "windows" }, { "platform": "mac" } ], "supported_devices": [ { "type": "dashboard_lcd", "features": ["sensor-screen"] }, { "type": "pump_lcd" }, { "type": "keyboard_lcd" } ] } ``` -------------------------------- ### Complete Widget Example - HTML Source: https://docs.elgato.com/icue/widgets/references/controls/textfield HTML file for the complete textfield widget example. It includes the meta tag for the textfield property, a group definition, and JavaScript to update the display with the entered text. Requires an icon.svg file to work. ```html 'Textfield Demo'
Hello World
``` -------------------------------- ### Complete Widget Example: Manifest and HTML Source: https://docs.elgato.com/icue/widgets/references/controls/tab-buttons A complete widget example for the tab-buttons control. The manifest defines the widget metadata and supported devices. The HTML includes the meta tag for the property, a group definition, and JavaScript to update the text alignment based on the selected value. Requires an icon.svg file. ```json { "author": "Corsair Team", "id": "com.corsair.tabbuttonsdemo", "name": "Tab Buttons Demo", "description": "Tab Buttons Demo", "version": "1.0.0", "preview_icon": "icon.png", "min_framework_version": "1.0.0", "os": [ { "platform": "windows" }, { "platform": "mac" } ], "supported_devices": [ { "type": "dashboard_lcd", "features": ["sensor-screen"] }, { "type": "pump_lcd" }, { "type": "keyboard_lcd" } ] } ``` ```html 'Tab Buttons Demo'
Hello
``` -------------------------------- ### QML example: Initialize and connect StreamDeck Source: https://docs.elgato.com/icue/widgets/references/plugins/stream-deck Shows how to import the widgetbuilder.streamdeck module, create a StreamDeck object, handle virtualDeviceCreated and buttonIconUpdated signals, and connect to the device in Component.onCompleted using connectStreamDeck with a 5x3 grid. ```qml import QtQuick import widgetbuilder.streamdeck Item { id: root property string widgetId: "{widget-id-from-environment}" property string deviceId: "{streamdeck-device-id-from-environment}" StreamDeck { id: streamDeck onVirtualDeviceCreated: function(widgetId, deviceId) { // Handle initial virtual device creation } onButtonIconUpdated: function(widgetId, buttonIndex, iconDataUrl) { // Update button visuals in QML if needed } } Component.onCompleted: { streamDeck.connectStreamDeck(widgetId, deviceId, 5, 3); } } ``` -------------------------------- ### Complete example: translation.json Source: https://docs.elgato.com/icue/widgets/references/translations A complete translation file with English and Ukrainian translations for a clock widget. ```json { "en": { "translation": { "Clock": "Clock", "Time Zone": "Time Zone", "Text Color": "Text Color", "Appearance": "Appearance" } }, "uk": { "translation": { "Clock": "Годинник", "Time Zone": "Часовий пояс", "Text Color": "Колір тексту", "Appearance": "Зовнішній вигляд" } } } ``` -------------------------------- ### Directory Structure Example Source: https://docs.elgato.com/icue/widgets/specification Shows the recommended file layout for an iCUE widget, including required files and optional folders for modules, scripts, styles, and resources. ```text mywidget/ ├── index.html ├── manifest.json ├── translation.json ├── modules/ │ └── CitySearch.mjs ├── scripts/ │ └── widget.js ├── styles/ │ └── style.css └── resources/ ├── icon.png └── thumbnail.png ``` -------------------------------- ### Minimal HTML Example Source: https://docs.elgato.com/icue/widgets/specification A minimal HTML widget structure with required head elements: title and icon link. ```html My Widget ``` -------------------------------- ### Example lifecycle: slider control with refresh rate Source: https://docs.elgato.com/icue/widgets/references/controls Complete example showing how to define a slider control in the head, group it in a property group, and use the injected global variable in the widget script. The onICUEInitialized and onDataUpdated events are used to initialize and update the display. The refreshRate value is accessed directly and used to control a refresh loop. ```html
``` -------------------------------- ### Basic Syntax: Static and Dynamic Meta Parameters Source: https://docs.elgato.com/icue/widgets/references/javascript-expressions Shows two meta tags: one with a static value and one with a dynamic expression. The dynamic example uses tr() and SystemUtils.getSystemVolume() to evaluate at runtime. ```html ``` -------------------------------- ### Complete widget example - manifest Source: https://docs.elgato.com/icue/widgets/references/controls/slider Manifest JSON for a complete slider demo widget, specifying author, id, name, description, version, preview icon, minimum framework version, supported OS, and supported devices. ```json { "author": "Corsair Team", "id": "com.corsair.sliderdemo", "name": "Slider Demo", "description": "Slider Demo", "version": "1.0.0", "preview_icon": "icon.png", "min_framework_version": "1.0.0", "os": [ { "platform": "windows" }, { "platform": "mac" } ], "supported_devices": [ { "type": "dashboard_lcd", "features": ["sensor-screen"] }, { "type": "pump_lcd" }, { "type": "keyboard_lcd" } ] } ``` -------------------------------- ### Open link in system browser with fallback Source: https://docs.elgato.com/icue/widgets/references/plugins/link-provider Example usage in `index.html`. The `openLink` function checks for the plugin and calls `window.plugins.Linkprovider.open(url)`. If the plugin is not available (e.g., browser testing), it falls back to `window.open(url, '_blank')`. ```html function openLink(url) { if (window.plugins && window.plugins.Linkprovider && pluginLinkprovider_initialized) { window.plugins.Linkprovider.open(url); } else { // Fallback for browser testing outside iCUE window.open(url, '_blank'); } } openLink("https://www.corsair.com/ww/en"); ``` -------------------------------- ### Include local wrapper files Source: https://docs.elgato.com/icue/widgets/references/plugins/media-data-provider Copy common/plugins/ from the documentation bundle into your widget folder and include these scripts via local ``` -------------------------------- ### Module File Structure: SystemUtils.mjs Source: https://docs.elgato.com/icue/widgets/references/javascript-expressions Example module file exporting functions for timezone, volume, and low light detection. Functions are exported using ES6 export syntax. ```javascript export function getCurrentTimezone() { return Intl.DateTimeFormat().resolvedOptions().timeZone; } export function getAvailableTimezones() { return ["America/New_York", "Europe/London", "Europe/Kyiv", "Asia/Tokyo", "Australia/Sydney"]; } export function getSystemVolume() { return 75; } export function isLowLightMode() { const hour = new Date().getHours(); return hour < 7 || hour > 20; } ``` -------------------------------- ### media-selector meta tag example Source: https://docs.elgato.com/icue/widgets/references/controls/media-selector Defines a media-selector property for a background image with filters for PNG, JPG, and GIF files. ```html ``` -------------------------------- ### Plugin Functions: Manifest and HTML Example Source: https://docs.elgato.com/icue/widgets/references/javascript-expressions Shows the manifest requiring a plugin and an HTML meta tag using a plugin function. Only blocking (synchronous) functions are supported; asynchronous functions cannot be used. ```json "required_plugins": [ "widgetbuilder.sensorsdataprovider:Sensors:1.0" ] ``` ```html ``` -------------------------------- ### Complete widget example - HTML Source: https://docs.elgato.com/icue/widgets/references/controls/slider HTML file for the complete slider demo widget. It includes the slider meta tag, a group definition, and JavaScript to update the displayed value. ```html 'Slider Demo'
100%
``` -------------------------------- ### Include required local wrapper files Source: https://docs.elgato.com/icue/widgets/references/plugins/sensors-data-provider Copy common/plugins/ from the documentation bundle into your widget folder and include these scripts via local ``` -------------------------------- ### Required local script includes for SimpleFpsApiWrapper Source: https://docs.elgato.com/icue/widgets/references/plugins/fps-data-provider Include these local wrapper files in your widget's HTML. Do not reference iCUE installation paths. ```html ``` -------------------------------- ### Switch meta tag example Source: https://docs.elgato.com/icue/widgets/references/controls/switch Defines a switch property named 'showLabel' with a default value of true. The data-type is 'switch' and data-default is a boolean. ```html ``` -------------------------------- ### Widget folder structure with common tools Source: https://docs.elgato.com/icue/widgets/references/common-tools Required folder layout for a widget that uses common tools. The `common` folder (or a specific tool subfolder) must be copied from `<>/widgets/` into the widget root so relative references like `common/tools/media_viewer/MediaViewer.js` resolve alongside `index.html`. ```text MyWidget/ ├── index.html ├── manifest.json └── common/ └── tools/ └── media_viewer/ ├── MediaViewer.js └── MediaViewer.css ``` -------------------------------- ### Async request pattern for getSensorValue Source: https://docs.elgato.com/icue/widgets/references/plugins/sensors-data-provider JavaScript example demonstrating the async request pattern: create a unique requestId, connect to the asyncResponse signal, and call getSensorValue. The response is logged when the requestId matches. ```javascript let nextRequestId = 0; const requestId = nextRequestId++; window.plugins.Sensorsdataprovider.asyncResponse.connect((id, value) => { if (id === requestId) { console.log("Sensor value:", value); } }); window.plugins.Sensorsdataprovider.getSensorValue(requestId, sensorId); ``` -------------------------------- ### textfield widget HTML example Source: https://docs.elgato.com/icue/widgets/references/controls/textfield Shows how to define a textfield property in HTML using the x-icue-property meta tag with data-type="textfield" and data-default="'Hello World'". The data-default attribute sets the initial text value. ```html ``` -------------------------------- ### Initialize SimpleMediaApiWrapper Source: https://docs.elgato.com/icue/widgets/references/plugins/media-data-provider Create an instance of SimpleMediaApiWrapper by passing the plugin instance from window.plugins.Mediadataprovider. The wrapper converts the callback-based API into Promises. ```javascript const api = new SimpleMediaApiWrapper(window.plugins.Mediadataprovider); ``` -------------------------------- ### Package widget with icuewidget CLI Source: https://docs.elgato.com/icue/widgets Run from the terminal in the directory containing your widget files. Validates the widget structure and manifest, creates an .icuewidget package file, and displays a summary of the packaging process. ```bash icuewidget package MyWidget ``` -------------------------------- ### getCurrentProcess(requestId) Source: https://docs.elgato.com/icue/widgets/references/plugins/fps-data-provider Gets the name of the current foreground process. The response is delivered via the asyncResponse signal with the matching requestId. ```APIDOC ## getCurrentProcess(requestId) ### Description Gets the name of the current foreground process. The response is delivered via the asyncResponse signal with the matching requestId. ### Method Async method (callback-based) ### Parameters - **requestId** (int) - Required - Request ID used to correlate the response. ### Response - **string** - Current foreground process name (file description from the executable) ### Example ```javascript let nextRequestId = 0; const requestId = nextRequestId++; window.plugins.Fpsdataprovider.asyncResponse.connect((id, value) => { if (id === requestId) { console.log("Current process:", value); } }); window.plugins.Fpsdataprovider.getCurrentProcess(requestId); ``` ``` -------------------------------- ### getCurrentFps(requestId) Source: https://docs.elgato.com/icue/widgets/references/plugins/fps-data-provider Gets the current FPS value asynchronously. The response is delivered via the asyncResponse signal with the matching requestId. ```APIDOC ## getCurrentFps(requestId) ### Description Gets the current FPS value asynchronously. The response is delivered via the asyncResponse signal with the matching requestId. ### Method Async method (callback-based) ### Parameters - **requestId** (int) - Required - Request ID used to correlate the response. ### Response - **int** - Current frames per second ### Example ```javascript let nextRequestId = 0; const requestId = nextRequestId++; window.plugins.Fpsdataprovider.asyncResponse.connect((id, value) => { if (id === requestId) { console.log("FPS value:", value); } }); window.plugins.Fpsdataprovider.getCurrentFps(requestId); ``` ``` -------------------------------- ### getAllSensorIds(requestId) Source: https://docs.elgato.com/icue/widgets/references/plugins/sensors-data-provider Gets all available sensor identifiers asynchronously. The response is delivered via the asyncResponse signal with the matching requestId. ```APIDOC ## getAllSensorIds(requestId) ### Description Gets all available sensor identifiers. ### Method Asynchronous method call ### Parameters - **requestId** (int) - Required - Request ID ### Response - **sensorIds** (string[]) - Array of sensor identifiers ``` -------------------------------- ### getSensorKind(requestId, sensorId) Source: https://docs.elgato.com/icue/widgets/references/plugins/sensors-data-provider Gets the sensor kind/category asynchronously. The response is delivered via the asyncResponse signal with the matching requestId. ```APIDOC ## getSensorKind(requestId, sensorId) ### Description Gets sensor kind/category. ### Method Asynchronous method call ### Parameters - **requestId** (int) - Required - Request ID - **sensorId** (string) - Required - Sensor identifier ### Response - **kind** (string) - Sensor kind (see sensor kind) ``` -------------------------------- ### getSensorType(requestId, sensorId) Source: https://docs.elgato.com/icue/widgets/references/plugins/sensors-data-provider Gets the sensor type asynchronously. The response is delivered via the asyncResponse signal with the matching requestId. ```APIDOC ## getSensorType(requestId, sensorId) ### Description Gets sensor type. ### Method Asynchronous method call ### Parameters - **requestId** (int) - Required - Request ID - **sensorId** (string) - Required - Sensor identifier ### Response - **type** (string) - Sensor type (see sensor types) ``` -------------------------------- ### Media plugin initialization callback Source: https://docs.elgato.com/icue/widgets/references/plugins Initialization callback for the Media plugin, using the module name Mediadataprovider. ```javascript pluginMediadataproviderEvents = { onInitialized: onMediadataproviderInitialized, }; ``` -------------------------------- ### Async request pattern for getCurrentProcess Source: https://docs.elgato.com/icue/widgets/references/plugins/fps-data-provider Example of retrieving the current foreground process name using the same async pattern with requestId and asyncResponse. ```javascript let nextRequestId = 0; const requestId = nextRequestId++; window.plugins.Fpsdataprovider.asyncResponse.connect((id, value) => { if (id === requestId) { console.log("Current process:", value); } }); window.plugins.Fpsdataprovider.getCurrentProcess(requestId); ``` -------------------------------- ### getSensorName(requestId, sensorId) Source: https://docs.elgato.com/icue/widgets/references/plugins/sensors-data-provider Gets the sensor display name asynchronously. The response is delivered via the asyncResponse signal with the matching requestId. ```APIDOC ## getSensorName(requestId, sensorId) ### Description Gets sensor display name. ### Method Asynchronous method call ### Parameters - **requestId** (int) - Required - Request ID - **sensorId** (string) - Required - Sensor identifier ### Response - **name** (string) - Sensor display name ``` -------------------------------- ### getSensorUnits(requestId, sensorId) Source: https://docs.elgato.com/icue/widgets/references/plugins/sensors-data-provider Gets the units of measurement for a sensor asynchronously. The response is delivered via the asyncResponse signal with the matching requestId. ```APIDOC ## getSensorUnits(requestId, sensorId) ### Description Gets units of measurement. ### Method Asynchronous method call ### Parameters - **requestId** (int) - Required - Request ID - **sensorId** (string) - Required - Sensor identifier ### Response - **units** (string) - Units of measurement (e.g., "C", "%", "RPM") ``` -------------------------------- ### open(link) Source: https://docs.elgato.com/icue/widgets/references/plugins/link-provider Opens a link in the system browser. This method is available via window.plugins.Linkprovider.open(url) after the plugin is initialized. ```APIDOC ## open(link) ### Description Opens a link in the system browser. ### Method open ### Parameters - **link** (string) - Required - Link to open ### Example ```javascript function openLink(url) { if (window.plugins && window.plugins.Linkprovider && pluginLinkprovider_initialized) { window.plugins.Linkprovider.open(url); } else { // Fallback for browser testing outside iCUE window.open(url, '_blank'); } } openLink("https://www.corsair.com/ww/en"); ``` ``` -------------------------------- ### getSensorValue(requestId, sensorId) Source: https://docs.elgato.com/icue/widgets/references/plugins/sensors-data-provider Gets the current sensor value asynchronously. The response is delivered via the asyncResponse signal with the matching requestId. ```APIDOC ## getSensorValue(requestId, sensorId) ### Description Gets the current sensor value. ### Method Asynchronous method call ### Parameters - **requestId** (int) - Required - Request ID - **sensorId** (string) - Required - Sensor identifier ### Response - **value** (string) - The current sensor value ``` -------------------------------- ### SimpleMediaApiWrapper Source: https://docs.elgato.com/icue/widgets/references/plugins/media-data-provider Promise-based wrapper for the Media plugin. Converts the callback-based Qt async API into Promises. Provides getSongName() and getArtist() methods that return Promises. ```APIDOC ## SimpleMediaApiWrapper ### Description Promise-based wrapper for the Media plugin. Converts the callback-based Qt async API into Promises. ### Initialization ``` const api = new SimpleMediaApiWrapper(window.plugins.Mediadataprovider); ``` ### Constructor Parameters - **plugin** (object) - Required - Plugin instance (`window.plugins.Mediadataprovider`) - **timeoutMs** (number) - Optional - Request timeout (ms), default `5000` ### Methods #### getSongName() Returns `Promise` with the current song name. #### getArtist() Returns `Promise` with the current artist name. ### Required local files ``` ``` ### Example `manifest.json` ``` "required_plugins": [ "widgetbuilder.mediadataprovider:Media:1.0" ] ``` `index.html` ``` // After including IcueWidgetApiWrapper and SimpleMediaApiWrapper in : const mediaApi = new SimpleMediaApiWrapper(window.plugins.Mediadataprovider); async function displayCurrentTrack() { const [songName, artist] = await Promise.all([ mediaApi.getSongName(), mediaApi.getArtist(), ]); console.log(`Now playing: ${songName} by ${artist}`); } // Playback controls (synchronous — call directly on the plugin) window.plugins.Mediadataprovider.triggerPlayPause(); window.plugins.Mediadataprovider.triggerNextTrack(); window.plugins.Mediadataprovider.triggerPreviousTrack(); ``` ``` -------------------------------- ### getArtist(requestId) Source: https://docs.elgato.com/icue/widgets/references/plugins/media-data-provider Gets the current artist name asynchronously. The requestId is used for correlation, and the response is delivered via the asyncResponse signal. ```APIDOC ## getArtist(requestId) ### Description Gets the current artist name asynchronously. ### Method Plugin method ### Parameters - **requestId** (int) - Required - Request ID for correlation ### Response `string` - The current artist name ``` -------------------------------- ### getSongName(requestId) Source: https://docs.elgato.com/icue/widgets/references/plugins/media-data-provider Gets the current song name asynchronously. The requestId is used for correlation, and the response is delivered via the asyncResponse signal. ```APIDOC ## getSongName(requestId) ### Description Gets the current song name asynchronously. ### Method Plugin method ### Parameters - **requestId** (int) - Required - Request ID for correlation ### Response `string` - The current song name ``` -------------------------------- ### Switch usage in JavaScript Source: https://docs.elgato.com/icue/widgets/references/controls/switch Shows how to access the switch value in JavaScript. The variable 'showLabel' is a boolean, and the example uses it to control element visibility. ```javascript console.log(showLabel); // true element.style.display = showLabel ? "block" : "none"; ``` -------------------------------- ### Initialization Check Source: https://docs.elgato.com/icue/widgets/references/plugins Boolean variable indicating plugin load status. ```APIDOC ## Initialization Check ### Description Boolean variable indicating plugin load status. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example ```javascript pluginSensorsdataprovider_initialized pluginMediadataprovider_initialized pluginLinkprovider_initialized pluginFpsdataprovider_initialized pluginDeviceactionprovider_initialized ``` ### Response N/A ``` -------------------------------- ### Using tr() in JavaScript (async/await and Promise) Source: https://docs.elgato.com/icue/widgets/references/translations The tr() function returns a Promise. Shows both async/await and .then() usage to get translated strings. ```javascript async function updateUI() { const label = await tr("Hello"); document.getElementById("greeting").textContent = label; } tr("Settings").then((text) => { document.getElementById("title").textContent = text; }); ```