Full Code of xanderfrangos/twinkle-tray for AI

master 4fce279da9ac cached
158 files
1.4 MB
401.3k tokens
465 symbols
1 requests
Download .txt
Showing preview only (1,480K chars total). Download the full file or copy to clipboard to get everything.
Repository: xanderfrangos/twinkle-tray
Branch: master
Commit: 4fce279da9ac
Files: 158
Total size: 1.4 MB

Directory structure:
gitextract_15q36qbk/

├── .babelrc
├── .gitattributes
├── .github/
│   ├── FUNDING.yml
│   └── workflows/
│       └── ci.yml
├── .gitignore
├── .sassrc
├── .vscode/
│   └── settings.json
├── LICENSE
├── README.md
├── package.json
├── resources/
│   ├── appx/
│   │   └── extensions.xml
│   └── nsis/
│       └── installer.nsh
└── src/
    ├── Monitors.js
    ├── Translate.js
    ├── TranslateReact.js
    ├── Utils.js
    ├── components/
    │   ├── BrightnessPanel.jsx
    │   ├── DDCCISliders.jsx
    │   ├── HDRSliders.jsx
    │   ├── IntroWindow.jsx
    │   ├── MonitorFeatures.jsx
    │   ├── MonitorInfo.jsx
    │   ├── SafeRender.jsx
    │   ├── SettingsOption.jsx
    │   ├── SettingsWindow.jsx
    │   ├── Slider.jsx
    │   └── Titlebar.jsx
    ├── css/
    │   ├── common.scss
    │   ├── intro.scss
    │   ├── mica.scss
    │   ├── page.scss
    │   ├── panel.scss
    │   ├── settings-option.scss
    │   ├── slider.scss
    │   └── vars.scss
    ├── electron.js
    ├── hooks/
    │   └── useObject.js
    ├── html/
    │   ├── index.html
    │   ├── intro.html
    │   └── settings.html
    ├── intro-preload.js
    ├── intro.js
    ├── localization/
    │   ├── ar.json
    │   ├── az.json
    │   ├── bn.json
    │   ├── ckb.json
    │   ├── cs.json
    │   ├── de.json
    │   ├── el.json
    │   ├── en-GB.json
    │   ├── en.json
    │   ├── es.json
    │   ├── fa.json
    │   ├── fi.json
    │   ├── fr.json
    │   ├── he.json
    │   ├── hi.json
    │   ├── hr.json
    │   ├── hu.json
    │   ├── id.json
    │   ├── it.json
    │   ├── ja.json
    │   ├── ko.json
    │   ├── lt.json
    │   ├── nb.json
    │   ├── nl.json
    │   ├── pl.json
    │   ├── pt-BR.json
    │   ├── pt.json
    │   ├── ro.json
    │   ├── ru.json
    │   ├── sk.json
    │   ├── sv.json
    │   ├── ta.json
    │   ├── th.json
    │   ├── tr.json
    │   ├── uk.json
    │   ├── vi.json
    │   ├── zh-Hant.json
    │   └── zh_Hans.json
    ├── modules/
    │   ├── acrylic/
    │   │   ├── .gitignore
    │   │   ├── acrylic.cc
    │   │   ├── binding.gyp
    │   │   ├── index.js
    │   │   └── package.json
    │   ├── node-active-window/
    │   │   ├── .eslintrc.json
    │   │   ├── .gitignore
    │   │   ├── .prettierrc.json
    │   │   ├── CHANGELOG.md
    │   │   ├── LICENSE
    │   │   ├── README.md
    │   │   ├── binding.gyp
    │   │   ├── dist/
    │   │   │   ├── index.d.ts
    │   │   │   ├── index.js
    │   │   │   ├── types.d.ts
    │   │   │   └── types.js
    │   │   ├── module/
    │   │   │   └── windows/
    │   │   │       ├── demo/
    │   │   │       │   ├── Makefile
    │   │   │       │   └── main.cpp
    │   │   │       ├── napi/
    │   │   │       │   ├── main.cpp
    │   │   │       │   ├── module.cpp
    │   │   │       │   └── module.h
    │   │   │       └── src/
    │   │   │           ├── ActiveWindow.cpp
    │   │   │           └── ActiveWindow.h
    │   │   ├── package.json
    │   │   ├── src/
    │   │   │   ├── index.ts
    │   │   │   └── types.ts
    │   │   ├── tsconfig.build.json
    │   │   └── tsconfig.json
    │   ├── node-ddcci/
    │   │   ├── .clang-format
    │   │   ├── .gitignore
    │   │   ├── README.md
    │   │   ├── binding.gyp
    │   │   ├── ddcci.cc
    │   │   ├── index.d.ts
    │   │   ├── index.js
    │   │   ├── package.json
    │   │   └── vcp.js
    │   ├── tt-windows-utils/
    │   │   ├── .gitignore
    │   │   ├── binding.gyp
    │   │   ├── index.js
    │   │   ├── package.json
    │   │   ├── windows_app_startup.cc
    │   │   ├── windows_media_status.cc
    │   │   ├── windows_power_events.cc
    │   │   ├── windows_window_material.cc
    │   │   └── windows_window_utils.cc
    │   ├── win32-displayconfig/
    │   │   ├── .gitignore
    │   │   ├── CONTRIBUTORS
    │   │   ├── COPYRIGHT
    │   │   ├── README.md
    │   │   ├── binding.gyp
    │   │   ├── index.d.ts
    │   │   ├── index.js
    │   │   ├── package.json
    │   │   ├── scripts/
    │   │   │   ├── dumpextract.js
    │   │   │   ├── dumpquery.js
    │   │   │   └── watchmouse.js
    │   │   └── win32-displayconfig.cc
    │   ├── windows-hdr/
    │   │   ├── .gitignore
    │   │   ├── binding.gyp
    │   │   ├── index.js
    │   │   ├── package.json
    │   │   └── windows-hdr.cc
    │   └── wmi-bridge/
    │       ├── binding.gyp
    │       ├── example.js
    │       ├── index.js
    │       ├── package.json
    │       └── wmi-bridge.cc
    ├── monitor-rules.json
    ├── panel-preload.js
    ├── panel.js
    ├── parcel.js
    ├── parcelAPI.js
    ├── settings-preload.js
    ├── settings.js
    ├── utils/
    │   └── BrightnessPanel/
    │       └── getMonitorName.js
    ├── vcp-codes.js
    └── wmi-bridge-test.js

================================================
FILE CONTENTS
================================================

================================================
FILE: .babelrc
================================================
{
  "presets": ["@babel/preset-react"],
  "plugins": []
}


================================================
FILE: .gitattributes
================================================
# Auto detect text files and perform LF normalization
* text=auto


================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: "xanderfrangos" # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: "xanderfrangos" # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['paypal.me/xanderfrangos', 'xanderfrangos.com/crypto.md'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']


================================================
FILE: .github/workflows/ci.yml
================================================
name: CI Build

on: [push, pull_request]

env:
 BRANCH_NAME: ${{ github.head_ref || github.ref_name }} 

jobs:
  build:
    name: Build all
    runs-on: windows-2025

    steps:
      - uses: actions/checkout@v4
        name: Read repository
      
      - name: Set up Node.js 22
        uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: 'npm'
          
      - name: Get package.json info
        id: info
        uses: jaywcjlove/github-action-package@main
          
      - name: Prepare dependencies
        run: npm i
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          
      - name: Build assets
        run: npm run parcel-build
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          
      - name: Build Win32 installer
        run: npm exec electron-builder -- --x64 --config.extraMetadata.versionBuild="${{ steps.info.outputs.version }}+${{ github.sha }}" --config.win.artifactName="Twinkle.Tray.v${{ steps.info.outputs.version }}.exe" --publish="never"
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          
      - uses: actions/upload-artifact@v4
        name: Upload Win32 installer
        with:
          name: twinkle-tray-exe-${{ steps.info.outputs.version }}-${{ github.sha }}
          path: dist/*.exe

      - name: Get current date
        id: date
        uses: Kaven-Universe/github-action-current-date-time@v1
        with:
          format: "YYYY.1MMDD.1HHmm"
          
      - name: Build x64 AppX
        if: ${{ env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'ci-test' }}
        run: npm exec electron-builder -- --x64 --win appx --config.npmRebuild=false --config.extraMetadata.versionBuild="${{ steps.info.outputs.version }}+${{ github.sha }}" --config.extraMetadata.version=${{ steps.date.outputs.time }} --config.extraMetadata.name=twinkle-tray-appx --config.win.artifactName="Twinkle.Tray.v${{ steps.info.outputs.version }}-store.appx" --publish="never"
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          
      - uses: actions/upload-artifact@v4
        name: Upload x64 AppX
        if: ${{ env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'ci-test' }}
        with:
          name: twinkle-tray-appx-x64-${{ steps.info.outputs.version }}-${{ github.sha }}
          path: dist/*-store.appx
          
      - name: Build ARM64 Modules
        if: ${{ env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'ci-test' }}
        run: npx electron-rebuild --arch arm64 --types "prod"
          
      - name: Build ARM64 AppX
        if: ${{ env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'ci-test' }}
        run: npm exec electron-builder -- --arm64 --win appx --config.extraMetadata.versionBuild="${{ steps.info.outputs.version }}+${{ github.sha }}" --config.extraMetadata.version=${{ steps.date.outputs.time }} --config.extraMetadata.name=twinkle-tray-appx --config.win.artifactName="Twinkle.Tray.v${{ steps.info.outputs.version }}-store-arm64.appx" --config.npmRebuild=false --publish="never"
        env:
            GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
            
      - uses: actions/upload-artifact@v4
        name: Upload ARM64 AppX
        if: ${{ env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'ci-test' }}
        with:
          name: twinkle-tray-appx-arm64-${{ steps.info.outputs.version }}-${{ github.sha }}
          path: dist/*-store-arm64.appx


================================================
FILE: .gitignore
================================================
# dependencies
node_modules/

# production
build/
dist/

# misc
.cache
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
.idea

.log
logs/
*.pfx
.env
cache/
debug.log
bin/


================================================
FILE: .sassrc
================================================
{
    silenceDeprecations: ["legacy-js-api"]
}

================================================
FILE: .vscode/settings.json
================================================
{
    "files.associations": {
        "algorithm": "cpp",
        "array": "cpp",
        "atomic": "cpp",
        "bit": "cpp",
        "cctype": "cpp",
        "charconv": "cpp",
        "chrono": "cpp",
        "clocale": "cpp",
        "cmath": "cpp",
        "compare": "cpp",
        "complex": "cpp",
        "concepts": "cpp",
        "condition_variable": "cpp",
        "coroutine": "cpp",
        "csignal": "cpp",
        "cstdarg": "cpp",
        "cstddef": "cpp",
        "cstdint": "cpp",
        "cstdio": "cpp",
        "cstdlib": "cpp",
        "cstring": "cpp",
        "ctime": "cpp",
        "cwchar": "cpp",
        "deque": "cpp",
        "exception": "cpp",
        "format": "cpp",
        "forward_list": "cpp",
        "fstream": "cpp",
        "functional": "cpp",
        "initializer_list": "cpp",
        "iomanip": "cpp",
        "ios": "cpp",
        "iosfwd": "cpp",
        "iostream": "cpp",
        "istream": "cpp",
        "iterator": "cpp",
        "limits": "cpp",
        "list": "cpp",
        "locale": "cpp",
        "map": "cpp",
        "memory": "cpp",
        "mutex": "cpp",
        "new": "cpp",
        "numeric": "cpp",
        "optional": "cpp",
        "ostream": "cpp",
        "queue": "cpp",
        "ratio": "cpp",
        "shared_mutex": "cpp",
        "sstream": "cpp",
        "stdexcept": "cpp",
        "stop_token": "cpp",
        "streambuf": "cpp",
        "string": "cpp",
        "system_error": "cpp",
        "thread": "cpp",
        "tuple": "cpp",
        "type_traits": "cpp",
        "typeinfo": "cpp",
        "unordered_map": "cpp",
        "utility": "cpp",
        "vector": "cpp",
        "xfacet": "cpp",
        "xhash": "cpp",
        "xiosbase": "cpp",
        "xlocale": "cpp",
        "xlocbuf": "cpp",
        "xlocinfo": "cpp",
        "xlocmes": "cpp",
        "xlocmon": "cpp",
        "xlocnum": "cpp",
        "xloctime": "cpp",
        "xmemory": "cpp",
        "xstddef": "cpp",
        "xstring": "cpp",
        "xtr1common": "cpp",
        "xtree": "cpp",
        "xutility": "cpp"
    }
}

================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2019 Xander Frangos

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

================================================
FILE: README.md
================================================
<p align="center">
  <img src="https://raw.githubusercontent.com/xanderfrangos/twinkle-tray/master/src/assets/logo.png" width="128px" height="128px" alt="Twinkle Tray brightness slider logo">
</p>
<h1 align="center">Twinkle Tray</h1>

<p align="center"><a href="https://github.com/xanderfrangos/twinkle-tray/releases" target="_blank"><img src="https://img.shields.io/github/v/release/xanderfrangos/twinkle-tray" alt="Latest release" /></a> <a href="https://github.com/xanderfrangos/twinkle-tray/releases" target="_blank"><img src="https://img.shields.io/github/downloads/xanderfrangos/twinkle-tray/total" alt="Total downloads" /></a> <a href="https://hosted.weblate.org/projects/twinkle-tray/twinkle-tray/" target="_blank"><img src="https://hosted.weblate.org/widgets/twinkle-tray/-/twinkle-tray/svg-badge.svg" alt="Translations" /></a></p>

Twinkle Tray enables brightness control on external displays in Windows 10 & 11. Even though Windows is capable of adjusting the backlight on most monitors, it doesn't support external monitors natively. Windows also lacks any options to manage the brightness of multiple displays. This app inserts a new icon into your system tray, where you can click to have instant access to the brightness levels of all compatible displays. 

<img src="https://raw.githubusercontent.com/xanderfrangos/twinkle-tray/gh-pages/assets/img/tt-screenshot-w11.jpg" alt="Win 10 brightness slider" />

## Features
- Adds brightness sliders to the system tray, similar to the built-in Windows volume flyout.
- Seamlessly blends in with Windows 10 and Windows 11. Uses your Personalization settings to match your taskbar.
- Can automatically change monitor brightness depending on the time of day or when idle.
- Bind hotkeys to adjust the brightness of specific or all displays.
- Normalize backlight across different monitors.
- Control DDC/CI features such as contrast.
- Starts up with Windows.

### Design & Personalization

Twinkle Tray will automatically adjust the look and feel to match your Windows version and preferences. Additional options are available to select the Windows version and theme of your choice.

<img src="https://raw.githubusercontent.com/xanderfrangos/twinkle-tray/gh-pages/assets/img/tt-comparison.jpg" alt="Win 11 brightness slider" />

## Download

**Download the lastest version from [twinkletray.com](https://twinkletray.com/) or the [Releases page](https://github.com/xanderfrangos/twinkle-tray/releases).**

<a href="https://www.microsoft.com/store/productId/9PLJWWSV01LK" target="_blank"><img width="156" src="https://crushee.app/assets/img/ms-store.svg" alt="Get Twinkle Tray brightness slider from the Microsoft Store"></a>

## Install via Package Manager

### Windows Package Manager

```powershell
winget install xanderfrangos.twinkletray
```

### Chocolatey (unofficial)

[Chocolatey](https://chocolatey.org/) users can download and install Twinkle Tray from Chocolatey's Community Repository by installing the `twinkle-tray` package:

```powershell
choco install twinkle-tray
```

To upgrade to the latest approved package version, run the following command:

```powershell
choco upgrade twinkle-tray
```

**This package is not maintained at this repository**. Please do not create issues relating to the package here. Instead, go to the [package page](https://community.chocolatey.org/packages/twinkle-tray) and follow the [Package Triage Process](https://docs.chocolatey.org/en-us/community-repository/users/package-triage-process).

### Scoop (unofficial)

[Scoop](https://scoop.sh/) users can download and install Twinkle Tray from Scoop's Extras bucket by installing the `twinkle-tray` package:

```sh
scoop bucket add extras
scoop install extras/twinkle-tray
```

To upgrade to the latest approved package version, run the following command:

```sh
scoop update twinkle-tray
```

**This package is not maintained at this repository**. Please do not create issues relating to the package here. Instead, go to [ScoopInstallers/Extras](https://github.com/ScoopInstaller/Extras) and search for an existing [issue](https://github.com/ScoopInstaller/Extras/issues?q=is%3Aissue+twinkle-tray) or [discussion](https://github.com/ScoopInstaller/Extras/discussions?discussions_q=twinkle-tray) and create a new [issue](https://github.com/ScoopInstaller/Extras/issues/new/choose) or [discussion](https://github.com/ScoopInstaller/Extras/discussions/new/choose) if one does not already exist.

## Usage

- Download from the [Releases page](https://github.com/xanderfrangos/twinkle-tray/releases) and run the installer EXE.
- Once installation has finished, you should see the Twinkle Tray icon in your system tray. 
- Click the icon to bring up the Adjust Brightness flyout. 
- Click away to hide the flyout.
- Right-click the system tray icon to quit.

## Compatibility
Twinkle Tray uses DDC/CI and WMI to communicate with your monitors. Most monitors offer DDC/CI compatibility, but it may be off by default. Make sure you have the appropriate option(s) enabled on your monitor so that it can work with Twinkle Tray. Refer to your monitor's user manual for more information.

**Known issues:**
- The AMD Radeon Control Panel can interfere with Twinkle Tray. Ensure "Custom Colors" is not enabled.
- VGA/DVI may not be compatible.
- USB/Thunderbolt/Surface docks with HDMI or DisplayPort may not be compatible. 
- DDC/CI features such as brightness control and power state may cause certain models of monitors to behave poorly. This applies to any DDC/CI software, not just Twinkle Tray.

If some of your monitors are not being detected, please see [this page](https://github.com/xanderfrangos/twinkle-tray/wiki/Display-Detection-&-Support-Issues) for troubleshooting steps.

## Command Line Arguments

Twinkle Tray (v1.13.0+) supports requesting brightness changes from the command line. Twinkle Tray must already be running. One monitor argument and one brightness argument are required. Multiple arguments will override each other.

For example: `"%LocalAppData%\Programs\twinkle-tray\Twinkle Tray.exe" --MonitorNum=1 --Offset=-30` will adjust monitor number 1 by -30 brightness.

### Supported args:

- `--List` List all displays. *(available in v1.14.0+)*
- `--MonitorNum` Select monitor by number. Starts at 1. *Example: `--MonitorNum=2`*
- `--MonitorID` Select monitor by internal ID. Partial or whole matches accepted. *Example: `--MonitorID="UID2353"`*
- `--All` Flag to select all monitors.
- `--Set` Set brightness percentage. *Example: `--Set=95`*
- `--Offset` Adjust brightness percentage. *Example: `--Offset=-20`*
- `--VCP` Send a specific DDC/CI VCP code and value instead of brightness. The first part is the VCP code (decimal or hexadecimal), and the second is the value. *Example: `--VCP="0xD6:5"`* *(available in v1.14.4+)*
- `--Overlay` Flag to show new brightness levels in the overlay *Example: `--Overlay`*
- `--Panel` Flag to show new brightness levels in the panel *Example: `--Panel`*

*If you are using the Microsoft Store version of Twinkle Tray, you can access Twinkle Tray using the alias `Twinkle-Tray.exe` (v1.17.1+).*

## Localization
Thanks to [several contributors](https://github.com/xanderfrangos/twinkle-tray/graphs/contributors), Twinkle Tray is localized for multiple languages. If you'd like to create or update a localization, see [this page](https://github.com/xanderfrangos/twinkle-tray/wiki/Localization-files) for details. Special thanks to [Weblate](https://weblate.org/) for allowing free use of their service.

#### Localization progress
<a href="https://hosted.weblate.org/engage/twinkle-tray/?utm_source=widget">
<img src="https://hosted.weblate.org/widgets/twinkle-tray/-/multi-auto.svg" alt="Translation status" />
</a>

## Build Instructions
If you wish to run a development build of Twinkly Tray:

- Download or clone.
- Install the build tools for [`node-gyp`](https://github.com/nodejs/node-gyp#installation), if not already installed. You may already have these from installing NodeJS.
- Run `npm install`.
- Run `npm run build` to build an executable or `npm start` to run a development build.

*Note: Twinkle Tray must be built on Windows.*

## Special Thanks

Twinkle Tray was built using frameworks & libraries such as [Electron](https://electronjs.org/), [Node.js](https://nodejs.org/), [node-ddcci](https://github.com/hensm/node-ddcci), and [win32-displayconfig](<https://github.com/djsweet/win32-displayconfig>). Thanks to Weblate for allowing free use of their service, along with the many contributors to the localizations of Twinkle Tray. The app would not be nearly as popular without all of your help. And thank you for the many donations, small and large, over the years. 

## License

Copyright © 2020 Xander Frangos

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


================================================
FILE: package.json
================================================
{
  "name": "twinkle-tray",
  "version": "1.17.2",
  "description": "Manage the brightness of monitors from your system tray",
  "main": "src/electron.js",
  "scripts": {
    "start": "electron . --dev",
    "parcel": "node src/parcel.js --mode dev",
    "parcel-build": "node src/parcel.js --mode build",
    "clean": "npm ci",
    "dev": "electron . --dev",
    "electron-build": "electron-builder --x64",
    "postinstall": "electron-builder install-app-deps",
    "appx": "npm run parcel-build && electron-builder --x64 -w appx -c.extraMetadata.name=twinkle-tray-appx -c.win.artifactName=\"${productName} v${version}-store.${ext}\"",
    "appx-unsigned": "npm run parcel-build && electron-builder --x64 -w appx -c.appx.publisher=\"CN=AppModelSamples, OID.2.25.311729368913984317654407730594956997722=1\" -c.extraMetadata.name=twinkle-tray-appx -c.win.artifactName=\"${productName} v${version}-unsigned.${ext}\"",
    "portable": "npm run parcel-build && electron-builder --x64 -w zip -c.extraMetadata.name=twinkle-tray-portable -c.win.artifactName=\"${productName} v${version}-portable.${ext}\" -c.win.compression=normal",
    "arm64": "npm run parcel-build && electron-builder --arm64 -c.extraMetadata.name=twinkle-tray-arm64 -c.win.artifactName=\"${productName} v${version}-arm64.${ext}\" -c.win.compression=normal",
    "rebuild-ddcci-dev": "npm rebuild @hensm/ddcci",
    "appx-arm64": "npm run parcel-build && electron-builder --arm64 -w appx -c.extraMetadata.name=twinkle-tray-appx -c.win.artifactName=\"${productName} v${version}-store-arm64.${ext}\"",
    "build": "npm ci & npm run parcel-build && npm run electron-build",
    "build-all": "npm run build && npm run appx && npm run appx-arm64",
    "test-wmibridge": "node src/modules/wmi-bridge/example.js"
  },
  "keywords": [
    "electron",
    "react",
    "brightness",
    "set-brightness",
    "windows"
  ],
  "author": "Xander Frangos",
  "license": "MIT",
  "dependencies": {
    "@hensm/ddcci": "file:src/modules/node-ddcci",
    "@paymoapp/active-window": "file:src/modules/node-active-window",
    "acrylic": "file:src/modules/acrylic",
    "color": "^4.2.3",
    "ga4-mp": "^1.0.3",
    "global-mouse-events": "^1.2.0",
    "markdown-to-jsx": "^7.5.0",
    "stackblur-canvas": "^2.7.0",
    "studio-display-control": "^0.2.0",
    "suncalc": "^1.9.0",
    "tt-windows-utils": "file:src/modules/tt-windows-utils",
    "win32-displayconfig": "file:src/modules/win32-displayconfig",
    "windows-accent-colors": "^1.0.1",
    "windows-hdr": "file:src/modules/windows-hdr",
    "wmi-bridge": "file:src/modules/wmi-bridge",
    "wmi-client": "^0.5.0"
  },
  "optionalDependencies": {
    "native-reg": "^1.1.1"
  },
  "build": {
    "productName": "Twinkle Tray",
    "appId": "com.xanderfrangos.twinkle-tray",
    "compression": "normal",
    "electronLanguages": ["en-US"],
    "directories": {
      "buildResources": "resources"
    },
    "files": [
      "README.md",
      "src/electron.js",
      "src/panel-preload.js",
      "src/Translate.js",
      "src/settings-preload.js",
      "src/intro-preload.js",
      "src/monitor-rules.json",
      "src/localization/*",
      "src/Utils.js",
      "src/Monitors.js",
      "src/wmi-bridge-test.js",
      "src/vcp-codes.js",
      "src/assets/tray-icons/dark/*.ico",
      "src/assets/tray-icons/light/*.ico",
      "build/*",
      "!node_modules/@hensm/ddcci/build",
      "node_modules/@hensm/ddcci/build/Release/ddcci.node",
      "!src/modules/node-ddcci/build",
      "src/modules/node-ddcci/build/Release/ddcci.node",
      "!node_modules/node-addon-api/doc",
      "!node_modules/win32-displayconfig/node_modules*",
      "!node_modules/global-mouse-events/node_modules",
      "!node_modules/electron-acrylic-window/node_modules",
      "!node_modules/tt-windows-utils/node_modules",
      "!node_modules/windows-accent-colors/node_modules",
      "!node_modules/**/node-gyp/*",
      "!node_modules/**/*.ipdb",
      "!node_modules/**/*.pdb",
      "!node_modules/**/*.iobj",
      "!node_modules/**/*.obj",
      "!node_modules/**/*.lib",
      "!node_modules/**/*.h",
      "!node_modules/**/*.md",
      "!node_modules/**/*.c",
      "!node_modules/**/*.map",
      "!node_modules/**/*.log",
      "!node_modules/**/*.tlog",
      "!node_modules/**/*.vcxproj",
      "!node_modules/**/*.filters",
      "!node_modules/**/wmic_centos_x64",
      "!node_modules/**/wmic_ubuntu_x64",
      "!node_modules/sharp/vendor/*",
      "!node_modules/wmi-bridge/bin/*",
      "!node_modules/native-reg/prebuilds/*",
      "node_modules/native-reg/prebuilds/${platform}-${arch}/*",
      "!node_modules/native-reg/src/*",
      "!node_modules/acrylic/bin/**/*.node",
      "!node_modules/tt-windows-utils/bin/**/*.node",
      "!node_modules/win32-displayconfig/bin/**/*.node",
      "!node_modules/@paymoapp/active-window/module/*",
      "!node_modules/@paymoapp/active-window/src/*",
      "!node_modules/@paymoapp/active-window/build/Release/obj/*",
      "!node_modules/@paymoapp/active-window/*.json",
      "node_modules/@paymoapp/active-window/package.json",
      "!node_modules/iconv-lite",
      "!node_modules/cacache/*",
      "!node_modules/path-scurry/*",
      "!node_modules/tar/*",
      "!node_modules/@isaacs/*",
      "!node_modules/are-we-there-yet",
      "!node_modules/make-fetch-happen/*",
      "!node_modules/@npmcli/*",
      "!node_modules/node-gyp/*",
      "!node_modules/glob",
      "!node_modules/@pkgjs",
      "!node_modules/minizlib/*",
      "!node_modules/usb/libusb",
      "!node_modules/usb/prebuilds/*",
      "node_modules/usb/prebuilds/${platform}-${arch}/*"
    ],
    "extraResources": [
      "node_modules\\wmi-client\\lib\\*",
      "node_modules\\wmi-client\\scripts\\*",
      "node_modules\\wmi-client\\index.js",
      "node_modules\\wmi-client\\package.json",
      "node_modules\\wmi-client\\.jscsrc"
    ],
    "asar": true,
    "asarUnpack": [
      "node_modules\\wmi-client\\**\\*",
      "node_modules\\sharp\\**\\*",
      "**\\*.node",
      "src\\assets\\tray-icons\\dark\\*.ico",
      "src\\assets\\tray-icons\\light\\*.ico",
      "src\\assets\\logo.ico"
    ],
    "win": {
      "target": [
        "nsis"
      ],
      "artifactName": "${productName} v${version}.${ext}",
      "icon": "src/assets/logo.ico",
      "legalTrademarks": "Xander Frangos"
    },
    "appx": {
      "publisherDisplayName": "Xander Frangos",
      "applicationId": "TwinkleTray",
      "displayName": "Twinkle Tray",
      "identityName": "38002AlexanderFrangos.TwinkleTray",
      "publisher": "CN=B8E9A58B-32A7-4C6C-A474-D4BE2A3CEAD8",
      "showNameOnTiles": false,
      "backgroundColor": "#6b479c",
      "addAutoLaunchExtension": true,
      "customExtensionsPath": "resources/appx/extensions.xml"
    },
    "nsis": {
      "deleteAppDataOnUninstall": true,
      "include": "resources/nsis/installer.nsh",
      "warningsAsErrors": false
    }
  },
  "devDependencies": {
    "@babel/core": "^7.23.6",
    "@babel/plugin-proposal-class-properties": "^7.18.6",
    "@babel/preset-env": "^7.23.6",
    "@babel/preset-react": "^7.23.3",
    "@babel/runtime": "^7.23.6",
    "bindings": "1.5.0",
    "cross-env": "^7.0.3",
    "electron": "^39.2.6",
    "electron-builder": "26.3.2",
    "node-addon-api": "^8.2.2",
    "node-gyp": "^12.1.0",
    "parcel-bundler": "^1.12.5",
    "react": "18.3.1",
    "react-beautiful-dnd": "^13.1.1",
    "react-dom": "18.3.1",
    "sass": "^1.54.0"
  },
  "overrides": {
    "node-gyp": "$node-gyp",
    "bindings@<1.5.0": "1.5.0",
    "node-addon-api@<8.2.2": "8.2.2",
    "node-active-window": {
      "node-gyp": "$node-gyp",
      "bindings": "$bindings",
      "node-addon-api": "$node-addon-api"
    }
  }
}


================================================
FILE: resources/appx/extensions.xml
================================================
<!-- build/appx/extensions.xml -->
<uap5:Extension
  xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
  Category="windows.appExecutionAlias"
  Executable="app\Twinkle Tray.exe"
  EntryPoint="Windows.FullTrustApplication">
  <uap5:AppExecutionAlias>
    <uap5:ExecutionAlias Alias="Twinkle-Tray.exe" />
  </uap5:AppExecutionAlias>
</uap5:Extension>

================================================
FILE: resources/nsis/installer.nsh
================================================
 !macro customUnInstall
   DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "electron.app.Twinkle Tray"
 !macroend

================================================
FILE: src/Monitors.js
================================================
const tag = "\x1b[47m M \x1b[0m";
const oLog = console.log
console.log = (...args) => { args.unshift(tag); oLog(...args) }
console.log("Monitors.js starting. If you see this again, something bad happened!")
const w32disp = require("win32-displayconfig");
const wmibridge = require("wmi-bridge");
const hdr = require("windows-hdr");
const { exec } = require('child_process');
require("os").setPriority(0, require("os").constants.priority.PRIORITY_BELOW_NORMAL)

let lastDDCCIList = []
let lastRefresh = {}
let lastWin32 = {}
let lastWMI = {}
let lastHDR = {}

function deepCopy(obj) {
    try {
        return JSON.parse(JSON.stringify(obj))
    } catch(e) {
        return false
    }
}

process.on('message', async (data) => {
    try {
        if (data.type === "refreshMonitors") {
            if(data.clearCache) {
                vcpCache = {}
                monitorReports = {}
                monitorReportsRaw = {}
            }
            refreshMonitors(data.fullRefresh, data.ddcciType).then((results) => {
                lastRefresh = deepCopy(results)
                process.send({
                    type: 'refreshMonitors',
                    monitors: results
                })
            })
        } else if (data.type === "brightness") {
            setBrightness(data.brightness, data.id)
        }  else if (data.type === "sdr") {
            setSDRBrightness(data.brightness, data.id)
        } else if (data.type === "settings") {
            settings = data.settings

            // Overrides
            if (settings?.disableAppleStudio) appleStudioUnavailable = true;
            if (settings?.disableWMIC) wmicUnavailable = true;
            if (settings?.disableWMI) wmiFailed = true;
            if (settings?.disableWin32) win32Failed = true;

        } else if (data.type === "ddcBrightnessVCPs") {
            ddcBrightnessVCPs = data.ddcBrightnessVCPs
            // Update brightnessType for all monitors when user changes VCP settings
            if (monitors) {
                for (const hwid2 in monitors) {
                    if (monitors[hwid2].type === "ddcci") {
                        const hwid = monitors[hwid2].hwid
                        if (hwid) {
                            if (ddcBrightnessVCPs[hwid[1]]) {
                                // Custom VCP code set - use it (already parsed as int in electron.js)
                                const vcpCode = ddcBrightnessVCPs[hwid[1]]
                                if (!isNaN(vcpCode) && vcpCode >= 0 && vcpCode <= 0xFF) {
                                    monitors[hwid2].brightnessType = vcpCode
                                } else {
                                    // Invalid VCP code, fall back to default
                                    monitors[hwid2].brightnessType = 0x10
                                }
                            } else {
                                // No custom VCP - reset to default (0x10 = 16)
                                monitors[hwid2].brightnessType = 0x10
                            }
                        }
                    }
                }
            }
        } else if (data.type === "localization") {
            localization = data.localization
        } else if (data.type === "vcp") {
            setVCP(data.monitor, data.code, data.value)
        } else if (data.type === "flushvcp") {
            vcpCache = {}
            monitorReports = {}
            monitorReportsRaw = {}
            ddcci._clearDisplayCache()
        } else if (data.type === "wmi-bridge-ok") {
            canUseWmiBridge = data.value
        } else if (data.type === "getVCP") {
            getDDCCI()
            const vcp = await checkVCP(data.monitor, data.code)
            process.send({
                type: `getVCP::${data.monitor}::${data.code}`,
                monitor: data.monitor,
                code: data.code,
                value: vcp
            })
        } else if (data.type === "getReport") {
            process.send({
                type: `getReport`,
                report: {
                    lastDDCCIList,
                    lastWMI,
                    lastWin32,
                    lastHDR,
                    monitorsAppleStudio,
                    monitorReports,
                    monitorReportsRaw,
                    lastRefresh,
                    settings
                }
            })
        }
    } catch (e) {
        console.log(e)
    }
})

let isDev = (process.argv.indexOf("--isdev=true") >= 0)
let skipTest = (process.argv.indexOf("--skiptest=true") >= 0)

let monitors = false
let monitorNames = []
let monitorsAppleStudio = {}
let monitorsWin32 = {}
let monitorReports = {}
let monitorReportsRaw = {}

let settings = { order: [] }
let localization = {}
let canUseWmiBridge = false

let ddcBrightnessVCPs = {}

let busyLevel = 0
refreshMonitors = async (fullRefresh = false, ddcciType = "default", alwaysSendUpdate = false) => {
    try {
        if ((busyLevel > 0 && !fullRefresh) || (busyLevel > 0 && fullRefresh)) {
            console.log("Thread busy. Cancelling refresh.")
            return false
        }
        busyLevel = (fullRefresh ? 2 : 1)

        if (!monitors || fullRefresh) {
            const foundMonitors = await getAllMonitors(determineDDCCIMethod())
            monitors = foundMonitors
        } else {
            let startTime = process.hrtime()

            // DDC/CI
            try {
                if (settings?.getDDCBrightnessUpdates) {
                    if(!getDDCCI()) {
                        ddcci._refresh(determineDDCCIMethod(), true, !settings.disableHighLevel)
                    }
                    for (const hwid2 in monitors) {
                        if (monitors[hwid2].type === "ddcci" && monitors[hwid2].brightnessType) {
                            const monitor = await getBrightnessDDC(monitors[hwid2])
                            monitors[hwid2] = monitor
                        }
                    }
                    console.log(`getBrightnessDDC() Total: ${process.hrtime(startTime)[1] / 1000000}ms`)
                }
            } catch (e) {
                console.log("\x1b[41m" + "getBrightnessDDC() failed!" + "\x1b[0m", e)
            }

            // WMIC (Windows 10)
            if (!wmicUnavailable) {
                try {
                    startTime = process.hrtime.bigint()
                    const wmiBrightness = await getBrightnessWMIC()
                    console.log(`getBrightnessWMIC() Total: ${(startTime - process.hrtime.bigint()) / BigInt(-1000000)}ms`)

                    if (wmiBrightness) {
                        updateDisplay(monitors, wmiBrightness.hwid[2], wmiBrightness)

                        // If Win32 doesn't find the internal display, hide it.
                        if (settings?.hideClosedLid && Object.keys(monitorsWin32).indexOf(wmiBrightness.hwid[2]) < 0) {
                            updateDisplay(monitors, wmiBrightness.hwid[2], { type: "none" })
                        }
                    }
                } catch (e) {
                    console.log("\x1b[41m" + "getBrightnessWMIC() failed!" + "\x1b[0m", e)
                }
            }

            // WMI
            if (canUseWmiBridge && !wmiFailed && wmicUnavailable) {
                try {
                    startTime = process.hrtime.bigint()
                    const wmiBrightness = await getBrightnessWMI()
                    if (wmiBrightness) {
                        updateDisplay(monitors, wmiBrightness.hwid[2], wmiBrightness)

                        // If Win32 doesn't find the internal display, hide it.
                        if (settings?.hideClosedLid && Object.keys(monitorsWin32).indexOf(wmiBrightness.hwid[2]) < 0) {
                            updateDisplay(monitors, wmiBrightness.hwid[2], { type: "none" })
                        }
                    }
                    console.log(`getBrightnessWMI() Total: ${(startTime - process.hrtime.bigint()) / BigInt(-1000000)}ms`)
                } catch (e) {
                    console.log("\x1b[41m" + "getBrightnessWMI() failed!" + "\x1b[0m", e)
                }
            }

            // Apple Studio displays
            if (!appleStudioUnavailable) {
                try {
                    startTime = process.hrtime.bigint()
                    monitorsAppleStudio = await getStudioDisplay(monitors);
                    console.log(`getStudioDisplay() Total: ${(startTime - process.hrtime.bigint()) / BigInt(-1000000)}ms`)
                } catch (e) {
                    console.log("\x1b[41m" + "getStudioDisplay() failed!" + "\x1b[0m", e)
                }
            }

            // HDR
            if (!settings?.disableHDR) {
                try {
                    startTime = process.hrtime.bigint()
                    monitorsHDR = await getHDRDisplays(monitors);
                    console.log(`getHDRDisplays() Total: ${(startTime - process.hrtime.bigint()) / BigInt(-1000000)}ms`)
                } catch (e) {
                    console.log("\x1b[41m" + "getHDRDisplays() failed!" + "\x1b[0m", e)
                }
            }

            // Hide internal
            if (settings?.hideClosedLid) {
                const wmiMonitor = Object.values(monitors).find(mon => mon.type === "wmi")
                if (wmiMonitor && !monitorsWin32[wmiMonitor.hwid[2]]) {
                    updateDisplay(monitors, wmiMonitor.hwid[2], { type: "none" })
                }
            }

        }
    } catch (e) { console.log(e) }

    busyLevel = 0
    return monitors
}


getAllMonitors = async (ddcciMethod = "default") => {
    const foundMonitors = {}
    let startTime = process.hrtime.bigint()
    let fullStartTime = process.hrtime.bigint()

    // List via WMIC (Windows 10)
    if (!wmicUnavailable) {
        try {
            const monitorsWMIC = await getMonitorsWMIC()
            console.log(`getMonitorsWMIC() Total: ${(startTime - process.hrtime.bigint()) / BigInt(-1000000)}ms`)
            for (const hwid2 in monitorsWMIC) {
                const monitor = monitorsWMIC[hwid2]
                updateDisplay(foundMonitors, hwid2, monitor)
            }
        } catch (e) {
            console.log("\x1b[41m" + "getMonitorsWMIC() failed!" + "\x1b[0m", e)
        }
    }

    // List via WMI
    if (canUseWmiBridge && !wmiFailed && wmicUnavailable) {
        try {
            const monitorsWMI = await getMonitorsWMI()
            console.log(`getMonitorsWMI() Total: ${(startTime - process.hrtime.bigint()) / BigInt(-1000000)}ms`)
            for (const hwid2 in monitorsWMI) {
                const monitor = monitorsWMI[hwid2]
                updateDisplay(foundMonitors, hwid2, monitor)
            }
        } catch (e) {
            console.log("\x1b[41m" + "getMonitorsWMI() failed!" + "\x1b[0m", e)
        }
    } else if (wmiFailed) {
        console.log("getMonitorsWMI() skipped due to previous failure.")
    }

    // List via Win32 (more details)
    if (!win32Failed) {
        try {
            startTime = process.hrtime.bigint()
            monitorsWin32 = await getMonitorsWin32()
            console.log(`getMonitorsWin32() Total: ${(startTime - process.hrtime.bigint()) / BigInt(-1000000)}ms`)

            for (const hwid2 in monitorsWin32) {
                const monitor = monitorsWin32[hwid2]
                updateDisplay(foundMonitors, hwid2, monitor)
            }
        } catch (e) {
            console.log("\x1b[41m" + "getMonitorsWin32() failed!" + "\x1b[0m", e)
        }
    } else {
        console.log("getMonitorsWin32() skipped due to previous failure.")
    }

    // List Apple Studio displays
    if (!appleStudioUnavailable) {
        try {
            startTime = process.hrtime.bigint()
            monitorsAppleStudio = await getStudioDisplay(foundMonitors);
            console.log(`getStudioDisplay() Total: ${(startTime - process.hrtime.bigint()) / BigInt(-1000000)}ms`)
        } catch (e) {
            console.log("\x1b[41m" + "getStudioDisplay() failed!" + "\x1b[0m", e)
        }
    } else {
        console.log("getStudioDisplay() skipped due to previous failure.")
    }
    

    // DDC/CI Brightness + Features
    try {
        startTime = process.hrtime.bigint()
        const featuresList = await getFeaturesDDC(ddcciMethod, false)

        for (const hwid2 in featuresList) {
            const monitor = featuresList[hwid2]
            const { features, id, hwid, vcpCodes, path, ddcciSupported, highLevelSupported } = monitor
            const brightnessType = await determineBrightnessVCPCode(id)

            let ddcciInfo = {
                id: id,
                key: hwid2,
                hwid,
                path,
                ddcciSupported,
                highLevelSupported,
                features: features,
                vcpCodes: vcpCodes,
                type: ((ddcciSupported || highLevelSupported?.brightness) && brightnessType ? "ddcci" : "none"),
                min: 0,
                max: 100,
                brightnessType: brightnessType,
                brightnessValues: (features[brightnessType] ? features[brightnessType] : [50, 100])
            }

            let brightness;
            if(!settings.disableHighLevel && monitor.highLevelSupported?.brightness && !(brightnessType > 0x10)) {
                brightness = await getHighLevelBrightness(id)
            } else {
                brightness = await checkVCP(id, parseInt(brightnessType))
            }
            
            // Force lower max brightness for testing
            if(brightness?.[1]) {
                if(settings.debugForceBrightnessMax) brightness[1] = settings.debugForceBrightnessMax
            }

            if(brightness) {
                ddcciInfo.brightnessValues = brightness
                features[vcpStr(brightnessType)] = brightness
            }       

            ddcciInfo.brightnessRaw = ddcciInfo.brightnessValues[0]
            ddcciInfo.brightnessMax = ddcciInfo.brightnessValues[1]

            // Get normalization info
            ddcciInfo = applyRemap(ddcciInfo)

            // Unnormalize brightness
            ddcciInfo.brightness = normalizeBrightness(ddcciInfo.brightnessRaw, true, ddcciInfo.min, ddcciInfo.max)
            updateDisplay(foundMonitors, hwid2, ddcciInfo)
        }
        console.log(`getFeaturesDDC() Total: ${(startTime - process.hrtime.bigint()) / BigInt(-1000000)}ms`)
    } catch (e) {
        console.log("\x1b[41m" + "getFeaturesDDC() failed!" + "\x1b[0m", e)
    }

    if (!wmicUnavailable) {
        try {
            startTime = process.hrtime.bigint()
            const wmiBrightness = await getBrightnessWMIC()
            console.log(`getBrightnessWMIC() Total: ${(startTime - process.hrtime.bigint()) / BigInt(-1000000)}ms`)

            if (wmiBrightness) {
                updateDisplay(foundMonitors, wmiBrightness.hwid[2], wmiBrightness)

                // If Win32 doesn't find the internal display, hide it.
                if (settings?.hideClosedLid && Object.keys(monitorsWin32).indexOf(wmiBrightness.hwid[2]) < 0) {
                    updateDisplay(foundMonitors, wmiBrightness.hwid[2], { type: "none" })
                }
            }
        } catch (e) {
            console.log("\x1b[41m" + "getBrightnessWMIC() failed!" + "\x1b[0m", e)
        }
    }

    // WMI Brightness
    if (canUseWmiBridge && !wmiFailed && wmicUnavailable) {
        try {
            startTime = process.hrtime.bigint()
            const wmiBrightness = await getBrightnessWMI()
            console.log(`getBrightnessWMI() Total: ${(startTime - process.hrtime.bigint()) / BigInt(-1000000)}ms`)

            if (wmiBrightness) {
                updateDisplay(foundMonitors, wmiBrightness.hwid[2], wmiBrightness)

                // If Win32 doesn't find the internal display, hide it.
                if (settings?.hideClosedLid && Object.keys(monitorsWin32).indexOf(wmiBrightness.hwid[2]) < 0) {
                    updateDisplay(foundMonitors, wmiBrightness.hwid[2], { type: "none" })
                }
            }
        } catch (e) {
            console.log("\x1b[41m" + "getBrightnessWMI() failed!" + "\x1b[0m", e)
        }
    } else if (wmiFailed) {
        console.log("getBrightnessWMI() skipped due to previous failure.")
    }

    // HDR
    if (!settings.disableHDR) {
        try {
            startTime = process.hrtime.bigint()
            monitorsHDR = await getHDRDisplays(foundMonitors);
            console.log(`getHDRDisplays() Total: ${(startTime - process.hrtime.bigint()) / BigInt(-1000000)}ms`)
        } catch (e) {
            console.log("\x1b[41m" + "getHDRDisplays() failed!" + "\x1b[0m", e)
        }
    }

    // Hide internal
    if (settings?.hideClosedLid) {
        const wmiMonitor = Object.values(foundMonitors).find(mon => mon.type === "wmi")
        if (wmiMonitor && !monitorsWin32[wmiMonitor.hwid[2]]) {
            updateDisplay(foundMonitors, wmiMonitor.hwid[2], { type: "none" })
        }
    }

    // Finally, fix names/num
    try {
        let idx = 0
        for (const hwid2 in foundMonitors) {
            if (!foundMonitors[hwid2].name) foundMonitors[hwid2].name = `${localization.GENERIC_DISPLAY_SINGLE} ${idx + 1}`;
            foundMonitors[hwid2].num = idx;
            idx++
        }
    } catch (e) {
        console.log("\x1b[41m" + "Fixing names failed!" + "\x1b[0m", e)
    }

    console.log(`getAllMonitors() total: ${(fullStartTime - process.hrtime.bigint()) / BigInt(-1000000)}ms`)
    try {
        console.log(`Monitors found: ${Object.keys(foundMonitors)}`)
    } catch (e) { }
    return foundMonitors
}

function determineDDCCIMethod() {
    let ddcciMethod = (isFastFine ? "fast" : "accurate")

    const savedMethod = settings?.preferredDDCCIMethod
    const ddcciMethodValues = ["fast", "accurate", "no-validation", "legacy"]
    if(savedMethod && ddcciMethodValues.indexOf(savedMethod) >= 0) {
        ddcciMethod = savedMethod
    } 
    return ddcciMethod
}

let appleStudioUnavailable = false
getStudioDisplay = async (monitors) => {
    try {
        const sdctl = require("studio-display-control")
        const displays = {}
        let count = 0
        for (const display of sdctl.getDisplays()) {
            const serial = await display.getSerialNumber();
            const hwid = [
                "\\\\?\\DISPLAY",
                "APPAE3A",
                `APLSTD-${serial}-NUM${count}`
            ]
            updateDisplay(monitors, hwid[2], {
                name: "Apple Studio Display",
                type: "studio-display",
                key: hwid[2],
                id: `\\\\?\\${hwid[0]}#${hwid[1]}#${hwid[2]}`,
                hwid,
                serial,
                brightness: await display.getBrightness()
            });
            displays[hwid[2]] = display
            count++
        }
        return displays
    } catch (e) {
        console.log("\x1b[41m" + "getStudioDisplay(): failed to access Studio Display" + "\x1b[0m", e)
    }
    return {}
}

setStudioDisplayBrightness = async (serial, brightness) => {
    try {
        const sdctl = require("studio-display-control")
        for (const monitor of sdctl.getDisplays()) {
            const s = await monitor.getSerialNumber();
            if (s === serial) {
                await monitor.setBrightness(brightness);
            }
        }
    } catch (e) {
        console.log("\x1b[41m" + "setStudioDisplayBrightness(): failed to set brightness" + "\x1b[0m", e)
    }
}

getHDRDisplays = async (monitors) => {
    try {
        const displays = hdr.getDisplays()
        lastHDR = displays
        for(const display of displays) {
            const hwid = display.path.split("#")

            const newDisplay = {
                key: hwid[2],
                id: display.path,
                hwid,
                sdrNits: display.nits,
                sdrLevel: parseInt((display.nits - 80) / 4),
                hdr: (display.hdrActive ? "active" : display.hdrEnabled ? "supported" : "unsupported")
            }

            if(display.name) {
                newDisplay.name = display.name
            }

            updateDisplay(monitors, hwid[2], newDisplay);
            displays[hwid[2]] = display
        }
    } catch(e) {
        console.log("\x1b[41m" + "getHDRDisplays(): failed to access displays" + "\x1b[0m", e)
    }

    return monitors
}

let wmiFailed = false
getMonitorsWMI = () => {
    return new Promise(async (resolve, reject) => {
        const foundMonitors = {}
        try {
            const timeout = setTimeout(() => { wmiFailed = true; console.log("getMonitorsWMI Timed out."); reject({}) }, 4000)
            const wmiMonitors = await wmibridge.getMonitors();

            if (wmiMonitors.failed) {
                // Something went wrong
                console.log("\x1b[41m" + "Recieved FAILED response from getMonitors()" + "\x1b[0m")
                clearTimeout(timeout)
                resolve(foundMonitor)
            } else {
                // Sort through results
                for (let monitorHWID in wmiMonitors) {
                    const monitor = wmiMonitors[monitorHWID]

                    if (!monitor.InstanceName) continue;

                    let hwid = readInstanceName(monitor.InstanceName)
                    hwid[2] = hwid[2].split("_")[0]

                    const wmiInfo = {
                        id: `\\\\?\\${hwid[0]}#${hwid[1]}#${hwid[2]}`,
                        key: hwid[2],
                        hwid: hwid,
                        serial: monitor.SerialNumberID
                    }

                    if (monitor.UserFriendlyName !== null && monitor.UserFriendlyName !== "") {
                        wmiInfo.name = monitor.UserFriendlyName
                    }

                    foundMonitors[hwid[2]] = wmiInfo
                }
                clearTimeout(timeout)
            }
        } catch (e) {
            console.log(`getMonitorsWMI: Failed to get all monitors.`)
            console.log(e)
        }
        lastWMI = deepCopy(foundMonitors)
        resolve(foundMonitors)
    })
}

let win32Failed = false
getMonitorsWin32 = () => {
    let foundDisplays = {}
    return new Promise(async (resolve, reject) => {
        try {
            const timeout = setTimeout(() => { win32Failed = true; console.log("getMonitorsWin32 Timed out."); reject({}) }, 4000)
            let displays = []
            const displayConfig = await w32disp.extractDisplayConfig()

            // Filter results
            for (const display of displayConfig) {
                // Must be an active display
                if(display.inUse) {
                    displays.push(display)
                }
            }

            // Prepare results
            for (const monitor of displays) {
                const hwid = monitor.devicePath.split("#")
                hwid[2] = hwid[2].split("_")[0]

                const win32Info = {
                    id: `${hwid[0]}#${hwid[1]}#${hwid[2]}`,
                    key: hwid[2],
                    connector: monitor.outputTechnology,
                    hwid: hwid,
                    sourceID: monitor.sourceConfigId?.id,
                    scaling: monitor.scaling,
                    bounds: monitor.sourceMode
                }
                if (monitor.displayName?.length > 0) {
                    win32Info.name = monitor.displayName;
                }

                foundDisplays[hwid[2]] = win32Info
            }

            // Return prepared results
            clearTimeout(timeout)
        } catch (e) {
            console.log(`getMonitorsWin32: Failed to get all monitors. (L2)`, e)
        }
        lastWin32 = deepCopy(foundDisplays)
        resolve(foundDisplays)
    })
}

getFeaturesDDC = (ddcciMethod = "accurate") => {
    const monitorFeatures = {}
    return new Promise(async (resolve, reject) => {
        try {
            const timeout = setTimeout(() => { console.log("getFeaturesDDC Timed out."); reject({}) }, 80000)
            
            getDDCCI()
            await wait(10)

            // Sometimes the handles returned are NULL, so we should try again.
            let tmpDdcciMonitors = ddcci.getAllMonitors(ddcciMethod, true, !settings.disableHighLevel)
            if(tmpDdcciMonitors) {
                let doRetry = false
                for(const monitor of tmpDdcciMonitors) {
                    if(monitor.handleIsValid === false) {
                        doRetry = monitor
                        break
                    }
                }
                if(doRetry) {
                    console.log(`DDC/CI results contain a null handle (${doRetry?.deviceKey}). Trying again.`)
                    await wait(200)
                    tmpDdcciMonitors = ddcci.getAllMonitors(ddcciMethod, true, !settings.disableHighLevel)
                    for(const monitor of tmpDdcciMonitors) {
                        if(monitor.handleIsValid === false) {
                            console.log(`DDC/CI results still contain a null handle (${doRetry?.deviceKey}). Continuing anyway.`)
                            break
                        }
                    }
                }
            }

            const ddcciMonitors = tmpDdcciMonitors
            lastDDCCIList = ddcciMonitors

            for (let monitor of ddcciMonitors) {
                const id = monitor.deviceKey
                const featureTimeout = setTimeout(() => { console.log("getFeaturesDDC Timed out on monitor:", id); reject({}) }, 15000)
                const hwid = id.split("#")
                let features = {}

                // Apply capabilities report, if available.
                if(monitor.capabilities && !monitorReports[id]) {
                    monitorReports[id] = monitor.capabilities
                }

                if(monitor.ddcciSupported) {
                    await wait(10)
                    features = await checkMonitorFeatures(id, false, ddcciMethod)
                }

                monitorFeatures[hwid[2]] = {
                    id: `${hwid[0]}#${hwid[1]}#${hwid[2]}`,
                    hwid,
                    features,
                    ddcciSupported: monitor.ddcciSupported,
                    highLevelSupported: {
                        brightness: monitor.hlBrightnessSupported,
                        contrast: monitor.hlContrastSupported
                    },
                    path: monitor.fullName,
                    vcpCodes: (monitorReports[id] ? monitorReports[id] : {} )
                }
                clearTimeout(featureTimeout)
            }
            clearTimeout(timeout)
        } catch (e) {
            console.log(`getFeaturesDDC: Failed to get features.`)
            console.log(e)
        }

        resolve(monitorFeatures)
    })
}

checkMonitorFeatures = async (monitor, skipCache = false, ddcciMethod = "accurate") => {
    return new Promise(async (resolve, reject) => {
        const features = {}
        try {
            const hwid = monitor.split("#")

            // Detect valid VCP codes for display if not already available
            try {
                if(ddcciMethod === "accurate" && !monitorReports[monitor]) {
                    const reportRaw = ddcci.getCapabilitiesRaw(monitor)
                    if(reportRaw) {
                        monitorReportsRaw[monitor] = reportRaw
                        const report = ddcci._parseCapabilitiesString(reportRaw)
                        if(report && Object.keys(report)?.length > 0) {
                            monitorReports[monitor] = report
                        }
                    }
                }
            } catch(e) {
                console.log("Couldn't get capabilities report for monitor " + monitor)
            }

            let getAllValues = false
            if(getAllValues && monitorReports[monitor]) {
                for(const code in monitorReports[monitor]) {
                    features[vcpStr(code)] = await checkVCP(monitor, code)
                }
            } else {
                // Get custom DDC/CI features
                const settingsFeatures = settings?.monitorFeatures?.[hwid[1]]
                if(settingsFeatures) {
                    for(const vcp in settingsFeatures) {
                        if(ddcBrightnessVCPs[hwid[1]] && vcp == ddcBrightnessVCPs[hwid[1]]) {
                            continue; // Skip if custom brightness
                        }
                        if(settingsFeatures[vcp]) {
                            features[vcpStr(vcp)] = await checkVCPIfEnabled(monitor, parseInt(vcp), vcp, skipCache)
                        }
                    }
                }
                
                // Capabilities report allows us to skip this for unsupported codes, generally
                features["0x10"] = await checkVCPIfEnabled(monitor, 0x10, "luminance", skipCache)
                features["0x13"] = await checkVCPIfEnabled(monitor, 0x13, "brightness", skipCache)
                features["0x12"] = await checkVCPIfEnabled(monitor, 0x12, "contrast", skipCache)
                features["0xD6"] = await checkVCPIfEnabled(monitor, 0xD6, "powerState", skipCache)
                features["0x60"] = await checkVCPIfEnabled(monitor, 0x60, "inputControls", skipCache)
                features["0x62"] = await checkVCPIfEnabled(monitor, 0x62, "volume", skipCache)
            }


            
        } catch (e) {
            console.log(e)
        }
        resolve(features)
    })
}

determineBrightnessVCPCode = async (monitor) => {
    const hwid = monitor.split("#")
    if(ddcBrightnessVCPs?.[hwid[1]]) {
        return parseInt(ddcBrightnessVCPs[hwid[1]])
    }
    if(await checkIfVCPSupported(monitor, 0x10)) {
        return 0x10 // luminance
    }
    if(await checkIfVCPSupported(monitor, 0x13)) {
        return 0x13 // brightness
    }
    if(await checkIfVCPSupported(monitor, 0x6B)) {
        return 0x6b // backlight level white
    }
    if(await checkIfVCPSupported(monitor, 0x12)) {
        return 0x12 // contrast
    }
    return false
}

getBrightnessWMI = () => {
    // Request WMI monitors.
    return new Promise(async (resolve, reject) => {
        try {
            const timeout = setTimeout(() => { console.log("getBrightnessWMI Timed out."); reject(false) }, 4000)
            const monitor = await wmibridge.getBrightness();
            if (monitor.failed) {
                // Something went wrong
                clearTimeout(timeout)
                resolve(false)
            } else {
                let hwid = readInstanceName(monitor.InstanceName)
                hwid[2] = hwid[2].split("_")[0]

                let wmiInfo = {
                    id: `\\\\?\\${hwid[0]}#${hwid[1]}#${hwid[2]}`,
                    brightness: monitor.Brightness,
                    hwid: hwid,
                    min: 0,
                    max: 100,
                    type: 'wmi',
                }

                // Get normalization info
                wmiInfo = applyRemap(wmiInfo)

                // Unnormalize brightness
                wmiInfo.brightnessRaw = monitor.Brightness
                wmiInfo.brightness = normalizeBrightness(wmiInfo.brightness, true, wmiInfo.min, wmiInfo.max)
                clearTimeout(timeout)

                resolve(wmiInfo)
            }
        } catch (e) {
            console.log(e)
            resolve(false)
        }
    })

}

getBrightnessDDC = (monitorObj) => {
    return new Promise(async (resolve, reject) => {
        let monitor = Object.assign({}, monitorObj)

        try {
            const timeout = setTimeout(() => { console.log("getBrightnessDDC Timed out."); reject({}) }, 8000)
            const ddcciPath = monitor.hwid.join("#")

            // If brightness is not supported, stop
            if (!monitor?.brightnessType) {
                clearTimeout(timeout)
                resolve(monitor)
                return false
            }

            // Determine / get brightness
            let brightnessValues = await checkVCP(ddcciPath, monitor.brightnessType)

            // If something goes wrong and there are previous values, use those
            if (!brightnessValues) {
                console.log(`\x1b[41mNO BRIGHTNESS VALUES AVAILABLE FOR ${monitorObj.hwid[1]}\x1b[0m`)
                if (monitor.brightnessRaw !== undefined && monitor.brightnessMax !== undefined) {
                    console.log("\x1b[41mUSING PREVIOUS VALUES\x1b[0m")
                    brightnessValues = [monitor.brightnessRaw, monitor.brightnessMax]
                } else if (vcpCache[monitor] && vcpCache[monitor]["vcp_" + 0x10]) {
                    console.log("\x1b[41mUSING VCP CACHE\x1b[0m")
                    brightnessValues = vcpCache[monitor]["vcp_" + 0x10];
                } else {
                    console.log("CATASTROPHIC FAILURE", monitor)
                    // Catastrophic failure. Revert to defaults.
                    brightnessValues = [50, 100]
                }
            }

            monitor.brightness = brightnessValues[0] * (100 / (brightnessValues[1] || 100))
            monitor.brightnessMax = (brightnessValues[1] || 100)
            monitor.brightnessRaw = brightnessValues[0] // Raw value from DDC/CI. Not normalized or adjusted.

            // Get normalization info
            monitor = applyRemap(monitor)
            // Unnormalize brightness
            monitor.brightness = normalizeBrightness(monitor.brightness, true, monitor.min, monitor.max)

            // Get custom DDC/CI features
            const settingsFeatures = settings?.monitorFeatures?.[monitor.hwid[1]]
            if(settingsFeatures) {
                for(const vcp in settingsFeatures) {
                    if(vcp == monitor.brightnessType) {
                        continue; // Skip brightness
                    }
                    if(settingsFeatures[vcp]) {
                        monitor.features[vcpStr(vcp)] = await checkVCP(monitor.id, parseInt(vcp))
                    }
                }
            }

            clearTimeout(timeout)
            resolve(monitor)

        } catch (e) {
            console.log("updateBrightnessDDC: Couldn't get DDC/CI brightness.", e)
            resolve(monitorObj)
        }

    })
}

updateDisplay = (monitors, hwid2, info = {}) => {
    if (!monitors[hwid2]) {
        monitors[hwid2] = {
            id: null,
            key: null,
            num: null,
            brightness: 50,
            brightnessMax: 100,
            brightnessRaw: 50,
            type: "none",
            connector: "unknown",
            min: 0,
            max: 100,
            hwid: [],
            name: null,
            serial: null
        }
    }
    Object.assign(monitors[hwid2], info)
    return true
}

function setSDRBrightness(brightness, id) {
    if(settings.disableHDR) return false;
    try {
        console.log("sdr", brightness, id)
        return hdr.setSDRBrightness(id, (brightness * 0.01 * 400) + 80)
    } catch(e) {
        console.log(`Couldn't update SDR brightness! [${id}]`, e);
        return false
    }
}

function setBrightness(brightness, id) {
    try {
        if (id) {
            let monitor = Object.values(monitors).find(mon => mon.id?.indexOf(id) >= 0)
            if(monitor) {
                monitor.brightness = brightness
                // Check if user has set a custom brightness VCP code for this monitor
                const hasCustomBrightnessVCP = monitor.hwid && ddcBrightnessVCPs[monitor.hwid[1]]
                if (monitor.type == "studio-display") {
                    setStudioDisplayBrightness(monitor.serial, brightness)
                } else if(!settings.disableHighLevel && monitor.highLevelSupported?.brightness && !hasCustomBrightnessVCP) {
                    setHighLevelBrightness(monitor.hwid.join("#"), brightness)
                } else {
                    setVCP(monitor.hwid.join("#"), monitor.brightnessType, brightness)
                }
                // Update tracked brightness values
                const brightnessRaw = parseInt(brightness)
                monitor.brightness = brightnessRaw * (100 / (monitor.brightnessMax || 100))
                monitor.brightnessRaw = brightnessRaw
                if(monitor.brightnessValues) monitor.brightnessValues[0] = brightnessRaw;
            }
        } else {
            let monitor = Object.values(monitors).find(mon => mon.type == "wmi")
            monitor.brightness = brightness
            monitor.brightnessRaw = brightness
            if (!canUseWmiBridge || wmiFailed) {
                // If native WMI is disabled, fall back to old method
                exec(`powershell.exe -NoProfile (Get-WmiObject -Namespace root\\wmi -Class WmiMonitorBrightnessMethods).wmisetbrightness(0, ${brightness})"`)
            } else {
                // Set brightness via native WMI
                wmibridge.setBrightness(brightness);
            }
        }
    } catch (e) {
        console.log(`Couldn't update brightness! [${id}]`);
        console.log(monitors)
        console.log(e)
    }
}

let vcpCache = {}
async function checkVCPIfEnabled(monitor, code, setting, skipCache = false) {
    const vcpString = vcpStr(code)
    if(!code || code == "0x0") return false;
    try {
        const hwid = monitor.split("#")
        const userEnabledFeature = settings?.monitorFeatures?.[hwid[1]]?.[vcpString]
        const isInReport = monitorReports[monitor]?.[vcpString] ? true : false
        const hasReport = monitorReports[monitor] && Object.keys(monitorReports[monitor])?.length > 0 ? true : false
        
        if (hasReport && !isInReport) return false;

        // If we previously saw that a feature was supported, we shouldn't have to check again.
        if ((!skipCache || !userEnabledFeature) && vcpCache[monitor] && vcpCache[monitor]["vcp_" + vcpString]) return vcpCache[monitor]["vcp_" + vcpString];

        const vcpResult = await checkVCP(monitor, code)
        return vcpResult
    } catch (e) {
        console.log(`Error reading VCP code (if enabled) ${vcpString} for ${monitor}`, e)

        // Since it failed, let's check for an existing value first
        if(vcpCache[monitor]?.["vcp_" + vcpString]) {
            return vcpCache[monitor]["vcp_" + vcpString]
        }
        
        // Cached value can't be used, so we return false
        return false
    }
}

async function checkIfVCPSupported(monitor, code) {
    const vcpString = vcpStr(code)
    if(!code || code == "0x0") return false;
    try {
        const isInReport = monitorReports[monitor]?.[vcpString] ? true : false
        const hasReport = monitorReports[monitor] && Object.keys(monitorReports[monitor])?.length > 0 ? true : false
        
        if (hasReport && !isInReport) return false;

        // If we previously saw that a feature was supported, we shouldn't have to check again.
        if (vcpCache[monitor] && vcpCache[monitor]["vcp_" + vcpString]) return true;

        const vcpResult = await checkVCPIfEnabled(monitor, code)
        return (vcpResult ? true : false)
    } catch (e) {
        console.log(`Error checking VCP code support ${vcpString} for ${monitor}`, e)
        return false
    }
}

async function checkVCP(monitor, code, skipCacheWrite = false) {
    const vcpString = vcpStr(code)
    if(!code || code == "0x0") return false;
    try {
        let result = ddcci._getVCP(monitor, parseInt(vcpString))
        if (code === 96) return ddcci.getMonitorInputs(monitor)
        if (!skipCacheWrite) {
            if (!vcpCache[monitor]) vcpCache[monitor] = {};
            vcpCache[monitor]["vcp_" + vcpString] = result
        }
        if(settings.debugForceBrightnessMax && vcpString == "0x10") result[1] = settings.debugForceBrightnessMax; // Force lower max brightness for testing
        await wait(parseInt(settings?.checkVCPWaitMS || 20))
        return result
    } catch (e) {
        let reason = e
        if(e.message.indexOf("the I2C bus") > 0) reason = "I2C bus error";
        if(e.message.indexOf("does not support") > 0) reason = "VCP code unsupported";
        console.log(`Error reading VCP code ${vcpString} for ${monitor}. Reason: ${reason}`)

        // Since it failed, let's check for an existing value first
        if(vcpCache[monitor]?.["vcp_" + vcpString]) {
            return vcpCache[monitor]["vcp_" + vcpString]
        }
        
        // Cached value can't be used, so we return false
        return false
    }
}

async function setVCP(monitor, code, value) {
    if(busyLevel > 0) while(busyLevel > 0) { await wait(100) } // Wait until no longer busy
    try {
        const vcpString = vcpStr(code)
        let result = ddcci._setVCP(monitor, code, (value * 1))
        if (vcpCache[monitor]?.["vcp_" + vcpString]) {
            vcpCache[monitor]["vcp_" + vcpString][0] = (value * 1)
        }
        
        const hwid = monitor.split("#")
        if(monitors[hwid[2]]?.features?.[vcpString]) {
            monitors[hwid[2]].features[vcpString][0] = parseInt(value)
        }
        return result
    } catch (e) {
        return false
    }
}

async function getHighLevelBrightness(monitor) {   
    try {
        let result = ddcci._getHighLevelBrightness(monitor)
        return result
    } catch (e) {
        console.log(e)
        return false
    }
}

async function setHighLevelBrightness(monitor, value) {
    if(busyLevel > 0) while(busyLevel > 0) { await wait(100) } // Wait until no longer busy   
    try {
        let result = ddcci._setHighLevelBrightness(monitor, value)
        return result
    } catch (e) {
        console.log(e)
        return false
    }
}

function normalizeBrightness(brightness, unnormalize = false, min = 0, max = 100) {
    return brightness // Disabled because it wasn't working
    // Clean this up later
    // Really
    // Do it
    let level = brightness
    if (level > 100) level = 100;
    if (level < 0) level = 0;
    if (min > 0 || max < 100) {
        let out = level
        if (!unnormalize) {
            // Normalize
            out = (min + ((level / 100) * (max - min)))
        } else {
            // Unnormalize
            out = ((level - min) * (100 / (max - min)))
        }
        if (out > 100) out = 100;
        if (out < 0) out = 0;

        return Math.round(out)
    } else {
        return level
    }
}



function applyRemap(monitor) {
    if (settings.remaps) {
        for (let remapName in settings.remaps) {
            if (remapName == monitor.name || remapName == monitor.id) {
                let remap = settings.remaps[remapName]
                monitor.min = remap.min
                monitor.max = remap.max
                // Stop if using new scheme
                if (remapName == monitor.id) return monitor;
            }
        }
    }
    if (typeof monitor.min === "undefined") monitor.min = 0;
    if (typeof monitor.max === "undefined") monitor.max = 100;
    return monitor
}


function readInstanceName(insName) {
    return (insName ? insName.replace(/&amp;/g, '&').split("\\") : undefined)
}

function parseWMIString(str) {
    if (str === null) return str;
    let hexed = str.replace('{', '').replace('}', '').replace(/;0/g, ';32')
    var decoded = '';
    var split = hexed.split(';')
    for (var i = 0; (i < split.length); i++)
        decoded += String.fromCharCode(parseInt(split[i], 10));
    decoded = decoded.trim()
    return decoded;
}

let ddcci = false
function getDDCCI() {
    if (ddcci) return false;
    try {
        ddcci = require("@hensm/ddcci");
        if(isDev) ddcci._setLogLevel(2);
        return true;
    } catch (e) {
        console.log('Couldn\'t start DDC/CI', e);
        return false;
    }
}

let wmicUnavailable = false 
let wmi = false
// WMIC
function getWMIC() {
    if (wmi) return true;
    let WmiClient = false
    if (!require('fs').existsSync(process.env.SystemRoot + "\\System32\\Wbem\\WMIC.exe")) {
        console.log("\x1b[41mWARNING: WMIC unavailable! Using WMI Bridge instead.\x1b[0m")
        wmicUnavailable = true
        return false;
    }
    try {
        if (isDev) {
            WmiClient = require('wmi-client');
        } else {
            let path = process.argv.find((val) => { return (val.indexOf("--apppath=") >= 0) }).substring(10)
            WmiClient = require(require('path').join(path, '../node_modules/wmi-client'));
        }
        wmi = new WmiClient({
            host: 'localhost',
            namespace: '\\\\root\\WMI'
        });
        return true;
    } catch (e) {
        console.log('Couldn\'t start WMI', e);
        wmicUnavailable = true
        return false;
    }
}
getWMIC();

// Request Monitors via WMIC. (Windows 10 only)
getMonitorsWMIC = () => {

    return new Promise((resolve, reject) => {
        const wmiOK = getWMIC();
        if (!wmiOK) {
            resolve(false);
            return false;
        }
        wmi.query('SELECT * FROM WmiMonitorID', function (err, result) {
            let foundMonitors = {}
            if (err != null) {
                resolve(false)
            } else if (result) {
                // Apply names

                for (let monitor of result) {

                    if (!monitor.InstanceName) continue;

                    let hwid = readInstanceName(monitor.InstanceName)
                    hwid[2] = hwid[2].split("_")[0]

                    const wmiInfo = {
                        id: `\\\\?\\${hwid[0]}#${hwid[1]}#${hwid[2]}`,
                        key: hwid[2],
                        hwid: hwid,
                        serial: parseWMIString(monitor.SerialNumberID)
                    }

                    if (monitor.UserFriendlyName !== null && monitor.UserFriendlyName !== "") {
                        wmiInfo.name = parseWMIString(monitor.UserFriendlyName)
                    }

                    foundMonitors[hwid[2]] = wmiInfo
                }

                resolve(foundMonitors)
            } else {
                resolve(foundMonitors)
            }
        });
    })

}

// Request WMI brightness via WMIC. (Windows 10 only)
const getBrightnessWMIC = async () => {

    return new Promise((resolve, reject) => {
        try {
            const wmiOK = getWMIC();
            if (!wmiOK) {
                resolve(false);
                return {};
            }
            wmi.query('SELECT * FROM WmiMonitorBrightness', function (err, result) {
                if (err != null) {
                    resolve(false)
                } else if (result) {

                    for (let monitor of result) {

                        let hwid = readInstanceName(monitor.InstanceName)
                        hwid[2] = hwid[2].split("_")[0]

                        let wmiInfo = {
                            id: `\\\\?\\${hwid[0]}#${hwid[1]}#${hwid[2]}`,
                            brightness: monitor.CurrentBrightness,
                            hwid: hwid,
                            min: 0,
                            max: 100,
                            type: 'wmi',
                        }

                        // Get normalization info
                        wmiInfo = applyRemap(wmiInfo)

                        // Unnormalize brightness
                        wmiInfo.brightnessRaw = wmiInfo.brightness
                        wmiInfo.brightness = normalizeBrightness(wmiInfo.brightness, true, wmiInfo.min, wmiInfo.max)

                        resolve(wmiInfo)
                    }
                    resolve(false)
                } else {
                    reject(false)
                }
            });

        } catch (e) {
            console.log(e)
            resolve(false)
        }
    })

}

function wait(ms = 2000) {
    return new Promise(resolve => {
        setTimeout(() => {
            resolve(true);
        }, ms);
    });
}

function vcpStr(code) {
    return `0x${parseInt(code).toString(16).toUpperCase()}`
}

testDDCCIMethods = async () => {
    let fastIsFine = false
    try {
        if(skipTest) {
            console.log("Skipping DDC/CI test...")
            return false
        }

        console.log("Testing DDC/CI methods...")
        getDDCCI()
    
        let startTime = process.hrtime.bigint()
        const accurateResults = ddcci.getAllMonitors("accurate", false)
        const accurateIDs = []
        const accurateFeatures = []
        for(const monitor of accurateResults) {
            if(monitor.ddcciSupported) {
                accurateIDs.push(monitor.deviceKey)
                accurateFeatures[monitor.deviceKey] = await checkMonitorFeatures(monitor.deviceKey)
            }
        }
        const endTimeAcc = (startTime - process.hrtime.bigint()) / BigInt(-1000000)
        
        wait(50)
        vcpCache = {}
        monitorReports = {}
        monitorReportsRaw = {}
        ddcci._clearDisplayCache()
    
        startTime = process.hrtime.bigint()
        const fastResults = ddcci.getAllMonitors("fast", false)
        const fastIDs = []
        const fastFeatures = []
        for(const monitor of fastResults) {
            if(monitor.ddcciSupported) {
                fastIDs.push(monitor.deviceKey)
                fastFeatures[monitor.deviceKey] = await checkMonitorFeatures(monitor.deviceKey)
            }
        }
        const endTimeFast = (startTime - process.hrtime.bigint()) / BigInt(-1000000)
    
        fastIsFine = true
        let failReason
        if(fastResults.length !== accurateResults.length) {
            fastIsFine = false
            failReason = "Display counts don't match!"
        } else {
            for(const id of accurateIDs) {
                if(fastIDs.indexOf(id) === -1) {
                    fastIsFine = false
                    failReason = "Didn't find ID: " + id
                }
                if(JSON.stringify(fastFeatures[id]) != JSON.stringify(accurateFeatures[id])) {
                    failReason = "Features don't match: " + id
                }
            }
        }
        console.log("-------------- DDC/CI Tests --------------")
        console.log(`Accurate results took: ${endTimeAcc}ms`)
        console.log(`Fast results took: ${endTimeFast}ms`)
        console.log("Is fast fine?: " + fastIsFine)
        if(failReason) console.log("Reason: " + fastIsFine);
        if(!failReason) console.log(`Monitors: ${fastResults.length} | DDCCI: ${fastIDs.length}`);
        console.log("------------------------------------------")
        wait(50)
    } catch(e) {
        console.log("Error testing DDC/CI methods: ", e)
    }

    vcpCache = {}
    monitorReports = {}
    monitorReportsRaw = {}
    ddcci._clearDisplayCache()
    
    return fastIsFine
}


let isFastFine = true
testDDCCIMethods().then(result => {
    isFastFine = result
    if(!skipTest) {
        process.send({
            type: 'ddcciModeTestResult',
            value: isFastFine
        })
    }
    process.send({
        type: 'ready'
    })
})

================================================
FILE: src/Translate.js
================================================
class Translate {
    constructor(localizationData = {}, fallbackData = {}) {
        this.localizationData = localizationData
        this.fallbackData = fallbackData

        // getString shorthand
        this.t = this.getString
        this.h = this.getHTML
    }

    setLocalizationData(data = {}, fallback = {}) {
        this.localizationData = data
        this.fallbackData = fallback
    }

    makeTranslation(string, args = []) {
        let outString = string
        for (let i = 1; i <= args.length; i++) {
            outString = outString.replace(`{{${i}}}`, args[i - 1])
        }
        return outString
    }

    getString(key, ...args) {
        if (this.localizationData[key] !== undefined && this.localizationData[key] !== "") {
            return this.makeTranslation(this.localizationData[key], args)
        } else if (this.fallbackData[key] !== undefined & this.fallbackData[key] !== "") {
            return this.makeTranslation(this.fallbackData[key], args)
        } else {
            return ""
        }
    }
    getHTML(key, ...args) {
        return this.getString(key, args)
    }

}

module.exports = Translate

================================================
FILE: src/TranslateReact.js
================================================
import Translate from "./Translate"
import React from "react";

class TranslateReact extends Translate {

    getHTML(key, ...args) {
        if (this.localizationData[key] !== undefined) {
            return (<span dangerouslySetInnerHTML={{
                __html: this.makeTranslation(this.localizationData[key], args)
            }}></span>)
        } else if (this.fallbackData[key] !== undefined) {
            return (<span dangerouslySetInnerHTML={{
                __html: this.makeTranslation(this.fallbackData[key], args)
            }}></span>)
        } else {
            return key
        }
    }

}

module.exports = TranslateReact

================================================
FILE: src/Utils.js
================================================
const path = require('path');
const fs = require('fs')

function udpSendCommand(type, data, port = 14715, key) {
    return new Promise((resolve, reject) => {
        const client = require('dgram').createSocket('udp4')
        const udpTimeout = setTimeout(() => {
            clearTimeout(udpTimeout)
            reject("No response")
        }, 1000)

        client.on('message', (message, connection) => {
            resolve(message?.toString())
        })

        client.send(JSON.stringify({ type, data, key }), port, "localhost", err => {
            if (err) {
                reject('Failed to send command')
            }
        })
    })
}

function pipeSendCommand(type, data, port = 14715, key) {
    return new Promise((resolve, reject) => {
        const cmdTimeout = setTimeout(() => {
            clearTimeout(cmdTimeout)
            reject("No response")
        }, 1000)

        const client = require('net').connect('\\\\.\\pipe\\twinkle-tray\\cmds')

        client.on('data', function(message) {
            resolve(message?.toString())
        })

        try {
            client.write(JSON.stringify({ type, data, key }))
        } catch(e) {
            reject('Failed to send command:', e)
        }
    })
}

module.exports = {
    unloadModule: (name) => {
        try {
            if (require.cache[require.resolve(name)]) {
                delete require.cache[require.resolve(name)]
                console.log(`Unloaded module: ${name}`)
            }
        } catch (e) {
            console.log(`Couldn't unload module: ${name}`)
        }
    },
    wait(ms = 2000) {
        return new Promise(resolve => {
            setTimeout(() => {
                resolve(true);
            }, ms);
        });
    },
    processArgs: (commandLine) => {

        let validArgs = {}

        commandLine.forEach(argRaw => {

            const arg = argRaw.toLowerCase();

            // Use UDP
            if (arg.indexOf("--udp") === 0) {
                validArgs.UseUDP = true
            }

            // Get display by index
            if (arg.indexOf("--list") === 0) {
                validArgs.List = true
            }

            // Get display by index
            if (arg.indexOf("--monitornum=") === 0) {
                validArgs.MonitorNum = (arg.substring(13) * 1)
            }

            // Get display by ID (partial or whole)
            if (arg.indexOf("--monitorid=") === 0) {
                validArgs.MonitorID = arg.substring(12)
            }

            // Run on all displays
            if (arg.indexOf("--all") === 0 && arg.length === 5) {
                validArgs.All = true
            }

            // Use absolute brightness
            if (arg.indexOf("--set=") === 0) {
                validArgs.Brightness = (arg.substring(6) * 1)
                validArgs.BrightnessType = "set"
            }

            // Use relative brightness
            if (arg.indexOf("--offset=") === 0) {
                validArgs.Brightness = (arg.substring(9) * 1)
                validArgs.BrightnessType = "offset"
            }

            // Use time adjustments
            if (arg.indexOf("--usetime") === 0) {
                validArgs.UseTime = true
            }

            // DDC/CI command
            if (arg.indexOf("--vcp=") === 0 && arg.indexOf(":")) {
                validArgs.VCP = true
            }

            // Show overlay
            if (arg.indexOf("--overlay") === 0) {
                validArgs.ShowOverlay = true
            }

            // Show panel
            if (arg.indexOf("--panel") === 0) {
                validArgs.ShowPanel = true
            }

        })

        return validArgs
    },

    async handleProcessedArgs(args = {}, knownDisplaysPath, settingsPath) {

        let failed
        const settings = JSON.parse(fs.readFileSync(settingsPath))

        if (args.ShowPanel) {
            console.log(`Showing panel`)
        } else if (args.List) {
            //const displays = getKnownDisplays(knownDisplaysPath)

            const useUDP = (args.UseUDP ? true : false)
            const response = await (useUDP ? udpSendCommand : pipeSendCommand)("list", false, settings.udpPortActive, settings.udpKey)
            let displays = {}
            try {
                displays = JSON.parse(response || "")
            } catch(e) {
                console.log("Error parsing response")
            }

            Object.values(displays).forEach(display => {
                console.log(`
\x1b[36mMonitorNum:\x1b[0m ${display.num}
\x1b[36mMonitorID:\x1b[0m ${display.key}
\x1b[36mName:\x1b[0m ${display.name}
\x1b[36mBrightness:\x1b[0m ${display.brightness}
\x1b[36mType:\x1b[0m ${display.type}`)
            })

            failed = false;
            return true;
        } else {
            if (!(args.MonitorID !== undefined || args.MonitorNum !== undefined || args.All || args.UseTime)) {
                console.log("\x1b[41mMissing monitor argument.\x1b[0m")
                failed = true
            }
            if (args.Brightness === undefined && !args.VCP && !args.UseTime) {
                console.log("\x1b[41mMissing brightness argument.\x1b[0m")
                failed = true
            }
        }

        if (failed) {
            console.log(`
Supported args:

\x1b[36m--List\x1b[0m
List all displays.

\x1b[36m--MonitorNum\x1b[0m
Select monitor by number. Starts at 1.
\x1b[2mExample: --MonitorNum=2\x1b[0m

\x1b[36m--MonitorID\x1b[0m
Select monitor by internal ID. Partial or whole matches accepted.
\x1b[2mExample: --MonitorID="UID2353"\x1b[0m

\x1b[36m--All\x1b[0m
Flag to update all monitors.
\x1b[2mExample: --All\x1b[0m

\x1b[36m--Set\x1b[0m
Set brightness percentage.
\x1b[2mExample: --Set=95\x1b[0m

\x1b[36m--Offset\x1b[0m
Adjust brightness percentage.
\x1b[2mExample: --Offset=-20\x1b[0m

\x1b[36m--UseTime\x1b[0m
Adjust brightness using Time of Day Adjustments. 
\x1b[2mExample: --UseTime\x1b[0m

\x1b[36m--VCP\x1b[0m
Send a specific DDC/CI VCP code and value instead of brightness. The first part is the VCP code (decimal or hexadecimal), and the second is the value.
\x1b[2mExample: --VCP="0xD6:5"\x1b[0m

\x1b[36m--Overlay\x1b[0m
Flag to show brightness levels in the overlay
\x1b[2mExample: --Overlay\x1b[0m

\x1b[36m--Panel\x1b[0m
Flag to show brightness levels in the panel
\x1b[2mExample: --Panel\x1b[0m
`)
        } else {
            console.log("OK")
        }
    },
    vcpMap: {
        0x10: "luminance",
        0x13: "brightness",
        0x12: "contrast",
        0xD6: "powerState",
        0x62: "volume"
    },
    upgradeAdjustmentTimes,
    getVersionValue,
    lerp,
    parseTime,
    getCalibratedValue
}


function upgradeAdjustmentTimes(times = []) {
    const newTimes = []

    times.forEach(time => {
        if (time.time) {
            newTimes.push(time)
            return
        }

        const newTime = {
            brightness: (time.brightness ? time.brightness : 50),
            monitors: (time.monitors ? time.monitors : 50),
            time: "00:00"
        }

        // Convert to 24H
        const hourInt = parseInt(time.hour)
        const fixedHour = hourInt + (hourInt == 12 ? (time.am.toLowerCase() == "pm" ? 0 : -12) : (time.am.toLowerCase() == "pm" ? 12 : 0))
        newTime.time = (fixedHour < 10 ? "0" + fixedHour : fixedHour) + ":" + (time.minute < 10 ? "0" + time.minute : time.minute)

        newTimes.push(newTime)
    })

    return newTimes
}

// Convert version to a numeric value (v1.2.3 = 10020003)
function getVersionValue(version = 'v1.0.0') {
    let out = version.split('-')[0].replace("v", "").split(".")
    out = (out[0] * 10000 * 10000) + (out[1] * 10000) + (out[2] * 1)
    return parseInt(out)
}

function lerp(start, finish, perc) {
    return start * (1 - perc) + finish * perc
}

function parseTime(time) {
    return parseInt((time.split(":")[0] * 60) + (time.split(":")[1] * 1))
}

// Get known displays from file, along with current displays
function getKnownDisplays(knownDisplaysPath) {
    let known
    try {
        // Load known displays DB
        known = fs.readFileSync(knownDisplaysPath)
        known = JSON.parse(known)
    } catch (e) {
        known = {}
    }

    return known
}

/**
 * Maps a value (0–100) using calibration points.
 * By default, maps input to output. Can also reverse map output back to input.
 *
 * @param {number} value - The value to map (expected range: 0–100).
 * @param {Array<{input: number, output: number}>} calibrationPoints - 
 *        An array of calibration points.
 *        Example: [{input: 15, output: 30}, {input: 50, output: 60}]
 * @param {boolean} reverse - If true, maps output to input. Default is false (input to output).
 * @returns {number} - The mapped value.
 */
function getCalibratedValue(value, calibrationPoints = [], reverse = false) {
    // Ensure value is within 0–100
    value = Math.max(0, Math.min(100, value));

    // Add default start and end points if not provided
    const points = calibrationPoints.slice();

    // Handle min/max values if those points haven't been provided
    let hasMin = false;
    let hasMax = false;
    for (const point of points) {
        point.input = Math.max(0, Math.min(100, point.input));
        if (point.input === 0) hasMin = true;
        if (point.input === 100) hasMax = true;
    }

    if (!hasMin) {
        points.unshift({ input: 0, output: 0 });
    }
    if (!hasMax) {
        points.push({ input: 100, output: 100 });
    }

    // Sort points by input value
    points.sort((a, b) => a.input - b.input);

    if (reverse) {
        // Reverse mapping: output -> input
        // Find the two points between which the output falls
        for (let i = 0; i < points.length - 1; i++) {
            const p1 = points[i];
            const p2 = points[i + 1];

            // Check if output falls between these two points
            const minOutput = Math.min(p1.output, p2.output);
            const maxOutput = Math.max(p1.output, p2.output);

            if (value >= minOutput && value <= maxOutput) {
                // Linear interpolation in reverse
                if (p2.output === p1.output) {
                    // If outputs are the same, return the midpoint input
                    return (p1.input + p2.input) / 2;
                }
                const ratio = (value - p1.output) / (p2.output - p1.output);
                return p1.input + ratio * (p2.input - p1.input);
            }
        }
        // Fallback
        return value;
    } else {
        // Forward mapping: input -> output
        if (value === 0 && points.length > 0 && points[0].input === 0) {
            return points[0].output;
        }

        // Find the two points between which the input falls
        for (let i = 0; i < points.length - 1; i++) {
            const p1 = points[i];
            const p2 = points[i + 1];

            if (value >= p1.input && value <= p2.input) {
                // Linear interpolation
                const ratio = (value - p1.input) / (p2.input - p1.input);
                return p1.output + ratio * (p2.output - p1.output);
            }
        }
        // Fallback
        return value;
    }
}

================================================
FILE: src/components/BrightnessPanel.jsx
================================================
import React, { memo, useEffect, useMemo, useState } from "react";
import Slider from "./Slider";
import DDCCISliders from "./DDCCISliders"
import HDRSliders from "./HDRSliders";
import TranslateReact from "../TranslateReact"
import getMonitorName from "../utils/BrightnessPanel/getMonitorName";

const BrightnessPanel = memo(function BrightnessPanel() {

  const [state, setState] = useState({
    monitors: [],
    linkedLevelsActive: false,
    names: {},
    update: false,
    sleeping: false,
    updateProgress: 0,
    isRefreshing: window.isRefreshing
  })
  const [doBackgroundEvent, setDoBackgroundEvent] = useState(false)
  const [levelsChanged, setLevelsChanged] = useState(false)
  const [init, setInit] = useState(false)
  const [lastLevels, setLastLevels] = useState([])
  const [T] = useState(new TranslateReact({}, {}))

  const numMonitors = useMemo(() => {
    let localNumMonitors = 0
    for (let key in state.monitors) {
      if ((state.monitors[key].type != "none" || state.monitors[key].hdr === "active") && !(window.settings?.hideDisplays?.[key] === true)) localNumMonitors++;
    }
    return localNumMonitors
  }, [state.monitors])

  let updateInterval = null
  let panelHeight = -1

  // Enable/Disable linked levels
  const toggleLinkedLevels = () => {
    const linkedLevelsActive = (state.linkedLevelsActive ? false : true)
    setState(prev => ({ ...prev, linkedLevelsActive }))
    window.sendSettings({
      linkedLevelsActive
    })
  }

  // Handle <Slider> changes
  const handleChange = (level, slider) => {
    const monitors = { ...state.monitors }
    const sliderMonitor = monitors[slider.props.hwid]
    if (numMonitors && state.linkedLevelsActive) {
      // Update all monitors (linked)
      for (let key in monitors) {
        const monitor = monitors[key]
        monitor.brightness = level
      }
      setState(prev => ({ ...prev, monitors }))
      setLevelsChanged(true)
      if (state.updateInterval === 999) syncBrightness()
    } else if (numMonitors > 0) {
      // Update single monitor
      if (sliderMonitor) sliderMonitor.brightness = level;
      setState(prev => ({ ...prev, monitors }))
      setLevelsChanged(true)
      if (state.updateInterval === 999) syncBrightness()
    }
    window.pauseMonitorUpdates()
  }

  // Update monitor info
  const recievedMonitors = (e) => {
    let newMonitors = { ...e.detail }
    setLastLevels([])
    // Reset panel height so it's recalculated
    panelHeight = -1
    setState(prev => ({
      ...prev,
      monitors: newMonitors
    }))
    // Delay initial adjustments
    if (!init) setTimeout(() => { setInit(true) }, 333)
  }

  const updateMinMax = (inMonitors = false) => {
    if (numMonitors > 0) {
      let newMonitors = Object.assign((inMonitors ? inMonitors : state.monitors), {})
      for (let key in newMonitors) {
        for (let remap in state.remaps) {
          if (newMonitors[key].name == remap) {
            newMonitors[key].min = state.remaps[remap].min
            newMonitors[key].max = state.remaps[remap].max
          }
        }
      }
      setLevelsChanged(true)
      if (inMonitors) {
        return inMonitors
      } else {
        setState(prev => ({
          ...prev,
          monitors: newMonitors
        }))
        setDoBackgroundEvent(true)
      }
    }
  }

  // Update settings
  const recievedSettings = (e) => {
    const settings = e.detail
    const linkedLevelsActive = (settings.linkedLevelsActive ?? false)
    const sleepAction = (settings.sleepAction ?? "none")
    const updateInterval = (settings.updateInterval || 500) * 1
    const remaps = (settings.remaps || {})
    const names = (settings.names || {})
    setLevelsChanged(true)
    setState(prev => ({
      ...prev,
      linkedLevelsActive,
      remaps,
      names,
      updateInterval,
      sleepAction
    }))
    resetBrightnessInterval()
    updateMinMax()
    setDoBackgroundEvent(true)
  }

  const recievedUpdate = (e) => {
    const update = e.detail
    setState(prev => ({ ...prev, update }))
  }

  const recievedSleep = (e) => {
    setState(prev => ({ ...prev, sleeping: e.detail }))
  }



  // Send new brightness to monitors, if changed
  const syncBrightness = () => {
    const monitors = state.monitors
    if (init && levelsChanged && (window.showPanel || doBackgroundEvent) && numMonitors) {
      setDoBackgroundEvent(false)
      setLevelsChanged(false)
      try {
        for (let idx in monitors) {
          if (monitors[idx].type != "none" && monitors[idx].brightness != lastLevels[idx]) {
            window.updateBrightness(monitors[idx].id, monitors[idx].brightness)
          }
        }
      } catch (e) {
        console.error("Could not update brightness")
      }
    }
  }

  const resetBrightnessInterval = () => {
    if (updateInterval) clearInterval(updateInterval)
    updateInterval = setInterval(() => syncBrightness(), (state.updateInterval || 500))
  }

  const handleIsRefreshingUpdate = (e) => setState(prev => ({ ...prev, isRefreshing: e.detail }))
  const handleUpdateProgress = (e) => setState(prev => ({ ...prev, updateProgress: e.detail.progress }))

  useEffect(() => {
    resetBrightnessInterval()
    return () => {
      clearInterval(updateInterval)
    }
  }, [state.monitors, numMonitors, doBackgroundEvent, levelsChanged, init])


  useEffect(() => {
    window.addEventListener("monitorsUpdated", (e) => recievedMonitors(e))
    window.addEventListener("settingsUpdated", (e) => recievedSettings(e))
    window.addEventListener("localizationUpdated", (e) => T.setLocalizationData(e.detail.desired, e.detail.default))
    window.addEventListener("updateUpdated", (e) => recievedUpdate(e))
    window.addEventListener("sleepUpdated", (e) => recievedSleep(e))
    window.addEventListener("isRefreshing", (e) => handleIsRefreshingUpdate(e))

    if (window.isAppX === false) {
      window.addEventListener("updateProgress", (e) => handleUpdateProgress(e))
    }

    // Update brightness every interval, if changed
    window.requestSettings()
    window.requestMonitors()
    window.ipc.send('request-localization')
    window.reactReady = true

    return () => {
      window.removeEventListener("monitorsUpdated")
      window.removeEventListener("settingsUpdated")
      window.removeEventListener("localizationUpdated")
      window.removeEventListener("updateUpdated")
      window.removeEventListener("sleepUpdated")
      window.removeEventListener("isRefreshing")
      window.removeEventListener("updateProgress")
    }
  }, [])

  useEffect(() => {
    const height = window.document.getElementById("panel").offsetHeight
    if (panelHeight != height) {
      panelHeight = height
      window.sendHeight(height)
    }
  })

  const getMonitors = () => {
    if (!state.monitors || numMonitors == 0) {
      if (state.isRefreshing) {
        return (<div className="no-displays-message" style={{ textAlign: "center", paddingBottom: "15px" }}>{T.t("GENERIC_DETECTING_DISPLAYS")}</div>)
      }
      return (<div className="no-displays-message">{T.t("GENERIC_NO_COMPATIBLE_DISPLAYS")}</div>)
    } else {
      if (state.linkedLevelsActive) {
        // Combine all monitors
        let lastValidMonitor
        for(const key in state.monitors) {
          const monitor = state.monitors[key]
          if(monitor.type == "wmi" || monitor.type == "studio-display" || (monitor.type == "ddcci" && monitor.brightnessType) || monitor.hdr === "active") {
           lastValidMonitor = monitor 
          }
        }
        if (lastValidMonitor) {
          const monitor = lastValidMonitor
          return (
            <Slider name={T.t("GENERIC_ALL_DISPLAYS")} id={monitor.id} level={monitor.brightness} min={0} max={100} num={monitor.num} monitortype={monitor.type} hwid={monitor.key} key={monitor.key} onChange={handleChange} scrollAmount={window.settings?.scrollFlyoutAmount} />
          )
        }
        return (<div className="no-displays-message">{T.t("GENERIC_NO_COMPATIBLE_DISPLAYS")}</div>)
      } else {
        // Show all valid monitors individually
        const sorted = Object.values(state.monitors).slice(0).sort((a, b) => {
          const aSort = (a.order === undefined ? 999 : a.order * 1)
          const bSort = (b.order === undefined ? 999 : b.order * 1)
          return aSort - bSort
        })
        let useFeatures = false
        // Check if we should use the extended DDC/CI layout or simple layout
        for (const { hwid } of sorted) {
          const monitorFeatures = window.settings?.monitorFeatures?.[hwid[1]]
          for (const vcp in monitorFeatures) {
            if (vcp == "0x10" || vcp == "0x13" || vcp == "0xD6") {
              continue; // Skip if brightness or power state
            }
            const feature = monitorFeatures[vcp]
            if (feature) {
              // Feature is active
              // Now we check if there are any settings active for the feature
              const featureSettings = window.settings.monitorFeaturesSettings?.[hwid[1]]
              if (!(featureSettings?.[vcp]?.linked)) {
                // Isn't linked
                useFeatures = true
              }
            }
          }
        }

        return sorted.map((monitor) => {
          if ((monitor.type == "none" && monitor.hdr !== "active") || window.settings?.hideDisplays?.[monitor.key] === true) {
            return (<div key={monitor.key}></div>)
          } else {
            if (monitor.type == "wmi" || monitor.type == "studio-display" || (monitor.type == "ddcci" && monitor.brightnessType) || monitor.hdr === "active") {

              let hasFeatures = true
              let featureCount = 0
              const monitorFeatures = window.settings?.monitorFeatures?.[monitor.hwid[1]]
              const features = ["0x12", "0xD6", "0x62"]
              if (monitor.features) {
                features.forEach(f => {
                  // Check monitor features
                  if (monitor.features[f] && monitor.features[f].length > 1) {
                    // Check that user has enabled feature
                    if (monitorFeatures && monitorFeatures[f]) {
                      // Track feature
                      hasFeatures = true
                      featureCount++
                    }
                  }
                })
              }
              let showHDRSliders = false
              if((monitor.hdr === "active" || window.settings?.hdrDisplays?.[monitor.key]) && !(window.settings?.sdrAsMainSliderDisplays?.[monitor.key])) {
                // Has HDR slider enabled
                hasFeatures = true
                useFeatures = true
                showHDRSliders = true
              }
              const powerOff = () => {
                window.ipc.send("sleep-display", monitor.hwid.join("#"))
                monitor.features["0xD6"][0] = (monitor.features["0xD6"][0] >= 4 ? 1 : settings.ddcPowerOffValue)
              }
              const showPowerButton = () => {
                const customFeatureEnabled = window.settings?.monitorFeaturesSettings?.[monitor?.hwid[1]]?.["0xD6"]
                if (monitorFeatures?.["0xD6"] && (monitor.features?.["0xD6"] || customFeatureEnabled)) {
                  return (<div className="feature-power-icon simple" onClick={powerOff}><span className="icon vfix">&#xE7E8;</span><span>{(monitor.features?.["0xD6"][0] >= 4 ? T.t("PANEL_LABEL_TURN_ON") : T.t("PANEL_LABEL_TURN_OFF"))}</span></div>)
                }
              }

              // Check if it's an HDR display and only supports SDR brightness adjustment.
              const isHDROnlySDR = (monitor.hdr === "active" || monitor.hdr === "supported") && monitor.type === "none";
              
              if (!useFeatures || !hasFeatures) {
                // For HDR displays that only support SDR, the HDR slider is displayed directly instead of the regular brightness slider.
                if (isHDROnlySDR) {
                  return (
                    <div className="monitor-sliders extended" key={monitor.key}>
                      <div className="monitor-item" style={{ height: "auto", paddingBottom: "18px" }}>
                        <div className="name-row">
                          <div className="icon"><span>&#xE7F4;</span></div>
                          <div className="title">{getMonitorName(monitor, state.names)}</div>
                          { showPowerButton() }
                        </div>
                      </div>
                      <HDRSliders monitor={monitor} scrollAmount={window.settings?.scrollFlyoutAmount} />
                    </div>
                  )
                }
                return (
                  <div className="monitor-sliders" key={monitor.key}>
                    <Slider name={getMonitorName(monitor, state.names)} id={monitor.id} level={monitor.brightness} min={0} max={100} num={monitor.num} monitortype={monitor.type} hwid={monitor.key} key={monitor.key} onChange={handleChange} afterName={showPowerButton()} scrollAmount={window.settings?.scrollFlyoutAmount} />
                  </div>
                )
              } else {
                return (
                  <div className="monitor-sliders extended" key={monitor.key}>
                    <div className="monitor-item" style={{ height: "auto", paddingBottom: "18px" }}>
                      <div className="name-row">
                        <div className="icon">{(monitor.type == "wmi" ? <span>&#xE770;</span> : <span>&#xE7F4;</span>)}</div>
                        <div className="title">{getMonitorName(monitor, state.names)}</div>
                        {showPowerButton()}
                      </div>
                    </div>
                    {/* For HDR displays that only support SDR, hide the regular brightness slider. */}
                    { !isHDROnlySDR && (
                      <div className="feature-row feature-brightness">
                        <div className="feature-icon"><span className="icon vfix">&#xE706;</span></div>
                        <Slider id={monitor.id} level={monitor.brightness} min={0} max={100} num={monitor.num} monitortype={monitor.type} hwid={monitor.key} key={monitor.key} onChange={handleChange} scrollAmount={window.settings?.scrollFlyoutAmount} />
                      </div>
                    )}
                    <DDCCISliders monitor={monitor} monitorFeatures={monitorFeatures} scrollAmount={window.settings?.scrollFlyoutAmount} />
                    {showHDRSliders ? <HDRSliders monitor={monitor} scrollAmount={window.settings?.scrollFlyoutAmount} /> : null}
                  </div>
                )
              }
            }
          }
        })
      }
    }
  }

  return (
    <div className="window-base" data-theme={window.settings.theme || "default"} id="panel" data-refreshing={state.isRefreshing}>
      <div className="titlebar">
        <div className="title">{T.t("PANEL_TITLE")}</div>
        <div className="icons">
          {
            numMonitors > 1 &&
            <div
              title={T.t("PANEL_BUTTON_LINK_LEVELS")}
              data-active={state.linkedLevelsActive}
              onClick={toggleLinkedLevels}
              className="link">
              &#xE71B;
            </div>
          }
          {
            window.settings.sleepAction !== "none" &&
            <div
              title={T.t("PANEL_BUTTON_TURN_OFF_DISPLAYS")}
              className="off"
              onClick={window.turnOffDisplays}>
              &#xF71D;
            </div>
          }
          <div title={T.t("GENERIC_SETTINGS")} className="settings" onClick={window.openSettings}>&#xE713;</div>
        </div>
      </div>
      {state.sleeping ? (<div></div>) : getMonitors()}
      {
        (state.update && state.update.show)
          ?
          <div className="updateBar">
            <div className="left">
              {T.t("PANEL_UPDATE_AVAILABLE")}
              ({state.update.version})
            </div>
            <div className="right">
              <a onClick={window.installUpdate}>
                {T.t("GENERIC_INSTALL")}
              </a>
              <a className="icon" title={T.t("GENERIC_DISMISS")} onClick={window.dismissUpdate}>
                &#xEF2C;
              </a>
            </div>
          </div>
          :
          (state.update && state.update.downloading)
          &&
          <div className="updateBar">
            <div className="left progress">
              <div className="progress-bar">
                <div style={{ width: `${state.updateProgress}%` }}>
                </div>
              </div>
            </div>
            <div className="right">
              {state.updateProgress}%
            </div>
          </div>
      }
      <div id="mica">
        <div className="displays" style={{ visibility: window.micaState.visibility }}>
          <div className="blur">
            <img alt="" src={window.micaState.src} width="2560" height="1440" />
          </div>
        </div>
        <div className="noise"></div>
      </div>
    </div>
  )
})

export default BrightnessPanel


================================================
FILE: src/components/DDCCISliders.jsx
================================================
import React from "react"
import { useObject } from "../hooks/useObject"
import Slider from "./Slider"

export default function DDCCISliders(props) {
    const { monitor, monitorFeatures } = props

    const defaultValues = {}

    for (const vcp in monitor?.features) {
        defaultValues[vcp] = vcp === "0x60"
            ? monitor?.features?.[vcp] ?? 0
            : monitor?.features?.[vcp]?.[0] ?? 0
    }
    const [values, setValues] = useObject(defaultValues)

    const inputsData = {
        1: "VGA-1",
        2: "VGA-2",
        3: "DVI-1",
        4: "DVI-2",
        5: "Composite video 1",
        6: "Composite video 2",
        7: "S-Video-1",
        8: "S-Video-2",
        9: "Tuner-1",
        10: "Tuner-2",
        11: "Tuner-3",
        12: "Component video (YPrPb/YCrCb) 1",
        13: "Component video (YPrPb/YCrCb) 2",
        14: "Component video (YPrPb/YCrCb) 3",
        15: "DisplayPort-1",
        16: "DisplayPort-2",
        17: "HDMI-1",
        18: "HDMI-2"
    }

    const changeInputsState = (code) => {
        const a = [code, [...values["0x60"][1]]]
        setValues({ ["0x60"]: a })
    }

    let extraHTML = []
    const featureSettings = window.settings?.monitorFeaturesSettings?.[monitor?.hwid[1]]

    if (monitor?.features) {
        let i = 0
        for (const vcp in monitor.features) {
            i++

            if (vcp == "0x10" || vcp == "0x13" || vcp == "0xD6") {
                continue; // Skip if brightness or power state
            }

            const feature = monitor.features[vcp]
            if (feature && monitorFeatures?.[vcp] && !(featureSettings?.[vcp]?.linked)) {
                // Feature has a value, is enabled, and not linked
                if (vcp === "0x12") {
                    // Contrast
                    extraHTML.push(
                        <div className="feature-row feature-contrast" key={monitor.key + "_" + vcp}>
                            <div className="feature-icon"><span className="icon vfix">&#xE793;</span></div>
                            <Slider type="contrast" monitorID={monitor.id} level={values[vcp]} monitorName={monitor.name} monitortype={monitor.type} onChange={val => { setValues({ [vcp]: val }); setVCP(monitor.id, parseInt(vcp), val * (monitor.features[vcp][1] / 100)) }} scrollAmount={props.scrollAmount} />
                        </div>
                    )
                } else if (vcp === "0x62") {
                    // Volume
                    extraHTML.push(
                        <div className="feature-row feature-volume" key={monitor.key + "_" + vcp}>
                            <div className="feature-icon"><span className="icon vfix">&#xE767;</span></div>
                            <Slider type="volume" monitorID={monitor.id} level={values[vcp]} monitorName={monitor.name} monitortype={monitor.type} onChange={val => { setValues({ [vcp]: val }); setVCP(monitor.id, parseInt(vcp), val * (monitor.features[vcp][1] / 100)) }} scrollAmount={props.scrollAmount} />
                        </div>
                    )
                } else if (vcp === "0x60") {
                    // Input
                    extraHTML.push(
                        <div className="feature-row feature-inputs" key={monitor.key + "_" + vcp}>
                            <div className="feature-icon"><span className="icon vfix">&#xE839;</span></div>
                            <div style={{ display: "flex", flexWrap: "wrap", gap: "3px" }}>
                                {values["0x60"][1].map(e =>
                                    <button key={e + monitor.id} className={values["0x60"][0] === e ? "button disabled" : "button"} disabled={values["0x60"][0] === e} onClick={() => { setVCP(monitor.id, parseInt(vcp), e); changeInputsState(e) }}>{inputsData[e]}</button>
                                )}
                            </div>
                        </div >
                    )
                } else {
                    // Custom
                    const settings = featureSettings?.[vcp] ?? {}
                    let icon
                    if (settings?.iconType === "windows" && settings?.icon) {
                        icon = (<span className="icon vfix" dangerouslySetInnerHTML={{ __html: `&#x${settings.icon};` }}></span>)
                    } else if (settings?.iconType === "text" && settings?.iconText) {
                        icon = (<span className="icon icon-text vfix">{settings.iconText}</span>)
                    } else {
                        // Default
                        icon = (<span className="icon vfix">&#xe897;</span>)
                    }
                    extraHTML.push(
                        <div className="feature-row feature-volume" key={monitor.key + "_" + vcp}>
                            <div className="feature-icon">{icon}</div>
                            <Slider type="custom" monitorID={monitor.id} level={values[vcp]} monitorName={monitor.name} monitortype={monitor.type} onChange={val => { setValues({ [vcp]: val }); setVCP(monitor.id, parseInt(vcp), val * (monitor.features[vcp][1] / 100)) }} scrollAmount={props.scrollAmount} />
                        </div>
                    )
                }
            }

        }
    }

    return (
        <>
            {extraHTML}
        </>
    )
}

function setVCP(monitor, code, value) {
    window.dispatchEvent(new CustomEvent("setVCP", {
        detail: {
            monitor,
            code,
            value
        }
    }))
}

================================================
FILE: src/components/HDRSliders.jsx
================================================
import React, { useState } from "react"
import { useObject } from "../hooks/useObject"
import Slider from "./Slider"

export default function HDRSliders(props) {
    const { monitor, name, hdrFeatures } = props
    const [sdrLevel, setSDRLevel] = useState(monitor?.sdrLevel)

    let extraHTML = []

    // SDR Brightness
    extraHTML.push(
        <div className="feature-row feature-sdr" key={monitor.key + "_sdr"}>
            <div className="feature-icon"><span className="text vfix">SDR</span></div>
            <Slider type="sdr" monitorID={monitor.id} level={sdrLevel} monitorName={monitor.name} monitortype={monitor.type} onChange={val => { setSDRLevel( val ); setSDRBrightness(monitor.id, parseInt(val)) }} scrollAmount={props.scrollAmount} />
        </div>
    )

    return (
        <>
        {extraHTML}
        </>
    )
}

function setSDRBrightness(monitor, value) {
    window.ipc.send("set-sdr-brightness", { monitor, value })
}


================================================
FILE: src/components/IntroWindow.jsx
================================================
import React, { PureComponent } from "react";
import TranslateReact from "../TranslateReact"
import AppLogo from "../assets/logo.png"
import IntroVideo from "../assets/intro-video.mp4"

let T = new TranslateReact({}, {})

export default class IntroWindow extends PureComponent {

    constructor(props) {
        super(props)
    }

    componentDidMount() {
        window.addEventListener("localizationUpdated", (e) => { T.setLocalizationData(e.detail.desired, e.detail.default); this.forceUpdate() })
        window.ipc.send('request-localization')
    }

    render() {
        return (
            <div className="page">
                <img src={AppLogo} />
                <div className="intro-title">{T.t("INTRO_TITLE")}</div>
                <p>{T.t("INTRO_INSTRUCTIONS")}</p>
                <video id="video" width="400" height="300" preload={true} loop={true}><source src={IntroVideo} type="video/mp4" /></video>
                <a className="button" onClick={window.closeIntro}>{T.t("GENERIC_CLOSE")}</a>
            </div>
        );
    }
}


================================================
FILE: src/components/MonitorFeatures.jsx
================================================
import React, { useState, useEffect } from "react"
import { useObject } from "../hooks/useObject"
import { SettingsOption, SettingsChild } from "./SettingsOption";
import Slider from "./Slider"
import VCP from "../vcp-codes"
const ignoreCodes = ["0x10", "0x12", "0x13", "0x62", "0xD6", "0x60"]

const deleteIcon = (<span className="icon" dangerouslySetInnerHTML={{ __html: "&#xE74D;" }}></span>)

export default function MonitorFeatures(props) {
    const { monitor, name, monitorFeatures, T, onChange } = props

    let extraHTML = []

    const inputsData = {
        1: "VGA-1",
        2: "VGA-2",
        3: "DVI-1",
        4: "DVI-2",
        5: "Composite video 1",
        6: "Composite video 2",
        7: "S-Video-1",
        8: "S-Video-2",
        9: "Tuner-1",
        10: "Tuner-2",
        11: "Tuner-3",
        12: "Component video (YPrPb/YCrCb) 1",
        13: "Component video (YPrPb/YCrCb) 2",
        14: "Component video (YPrPb/YCrCb) 3",
        15: "DisplayPort-1",
        16: "DisplayPort-2",
        17: "HDMI-1",
        18: "HDMI-2"
    }

    if (monitor.ddcciSupported && Object.keys(monitor.features || {}).length > 0) {

        // Brightness (with VCP Code Selection in expanded section)
        if (monitor.features["0x10"]) {
            const currentBrightnessVCP = window.settings?.userDDCBrightnessVCPs?.[monitor?.hwid?.[1]] || ""
            
            extraHTML.push(
                <SettingsOption className="monitor-feature-item" key="brightness" icon="e706" title={T.t("PANEL_LABEL_BRIGHTNESS")} expandable={true}>
                    <SettingsChild>
                        <BrightnessFeatureSettings hwid={monitor?.hwid?.[1]} currentBrightnessVCP={currentBrightnessVCP} T={T} />
                    </SettingsChild>
                </SettingsOption>
            )
        }

        // Contrast
        if (monitor.features["0x12"]) {
            const vcp = "0x12"
            const settings = window.settings?.monitorFeaturesSettings?.[monitor?.hwid[1]]?.[vcp]
            const enabled = monitorFeatures?.["0x12"];
            extraHTML.push(
                <SettingsOption className="monitor-feature-item" key={vcp} icon="E793" title={T.t("PANEL_LABEL_CONTRAST")} expandable={true} input={
                    <div className="inputToggle-generic"><input onChange={() => { props?.toggleFeature(monitor.hwid[1], vcp) }} checked={(enabled ? true : false)} data-checked={(enabled ? true : false)} type="checkbox" /></div>
                }>
                    <SettingsChild>
                        <MonitorFeaturesSettings onChange={onChange} key={vcp + "_settings"} enabled={enabled} settings={settings} hwid={monitor?.hwid?.[1]} T={T} vcp={vcp} />
                    </SettingsChild>
                </SettingsOption>
            )
        }

        // Volume
        if (monitor.features["0x62"]) {
            const vcp = "0x62"
            const settings = window.settings?.monitorFeaturesSettings?.[monitor?.hwid[1]]?.[vcp]
            const enabled = monitorFeatures?.["0x62"];
            extraHTML.push(
                <SettingsOption className="monitor-feature-item" key={vcp} icon="E767" title={T.t("PANEL_LABEL_VOLUME")} expandable={true} input={
                    <div className="inputToggle-generic"><input onChange={() => { props?.toggleFeature(monitor.hwid[1], vcp) }} checked={(enabled ? true : false)} data-checked={(enabled ? true : false)} type="checkbox" /></div>
                }>
                    <SettingsChild>
                        <MonitorFeaturesSettings onChange={onChange} key={vcp + "_settings"} enabled={enabled} settings={settings} hwid={monitor?.hwid?.[1]} T={T} vcp={vcp} />
                    </SettingsChild>
                </SettingsOption>
            )
        }

        // Input
        if (monitor.features["0x60"] && Array.isArray(monitor.features["0x60"]) && monitor.features["0x60"][1]) {
            const vcp = "0x60"
            const settings = window.settings?.monitorFeaturesSettings?.[monitor?.hwid[1]]?.[vcp]
            const enabled = monitorFeatures?.["0x60"];
            extraHTML.push(
                <SettingsOption className="monitor-feature-item" key={vcp} icon="e839" title={`${T.t("PANEL_LABEL_INPUTS")} ⚠️`} expandable={true} input={
                    <div className="inputToggle-generic"><input onChange={() => { props?.toggleFeature(monitor.hwid[1], vcp) }} checked={(enabled ? true : false)} data-checked={(enabled ? true : false)} type="checkbox" /></div>
                }>
                    <SettingsChild description={
                        <>
                            <div style={{ display: "flex", flexWrap: "wrap", gap: "10px" }}>
                                {(Array.isArray(monitor.features["0x60"][1]) ? monitor.features["0x60"][1] : [])?.map(e =>
                                    <div key={e + monitor.id} className="button" style={{ color: monitor.features[vcp] === e ? "red" : '' }} disabled={monitor.features[vcp] === e}>{inputsData[e]}</div>
                                )}
                            </div>
                            <div style={{ marginTop: "10px" }}>
                                ⚠️ {T.t("GENERIC_DDC_WARNING")}
                            </div>
                        </>
                    }>
                    </SettingsChild>
                </SettingsOption>
            )
        }

        // Power State
        if (monitor.features["0xD6"]) {
            const vcp = "0xD6"
            const enabled = monitorFeatures?.["0xD6"];
            extraHTML.push(
                <SettingsOption className="monitor-feature-item" key={vcp} icon="E7E8" title={`${T.t("PANEL_LABEL_OFF_ON")} ⚠️`} expandable={true} input={
                    <div className="inputToggle-generic"><input onChange={() => { props?.toggleFeature(monitor.hwid[1], vcp) }} checked={(enabled ? true : false)} data-checked={(enabled ? true : false)} type="checkbox" /></div>
                }>
                    <SettingsChild description={`⚠️ ${T.t("GENERIC_DDC_WARNING")}`} />
                </SettingsOption>
            )
        }

        const deleteFeature = vcp => {
            if (monitorFeatures[vcp] != undefined) {
                delete window.settings?.monitorFeatures[monitor.hwid[1]][vcp]
            }
            if (window.settings?.monitorFeaturesSettings?.[monitor?.hwid[1]]?.[vcp] !== undefined) {
                delete window.settings?.monitorFeaturesSettings?.[monitor?.hwid[1]]?.[vcp]
            }
            window.sendSettings({ monitorFeatures: window.settings?.monitorFeatures, monitorFeaturesSettings: window.settings?.monitorFeaturesSettings })
        }

        // Custom Features
        for (const vcp in monitorFeatures) {
            if (ignoreCodes.indexOf(vcp) === -1 && monitorFeatures[vcp] !== undefined) {
                const settings = window.settings?.monitorFeaturesSettings?.[monitor?.hwid[1]]?.[vcp]
                const enabled = monitorFeatures?.[vcp];
                const name = (settings?.iconType === "text" && settings?.iconText?.length ? settings.iconText : "Custom Feature")
                const icon = (settings?.iconType === "windows" && settings?.icon ? settings.icon : "E9E9")
                extraHTML.push(
                    <SettingsOption className="monitor-feature-item" key={vcp} icon={icon} title={`${name} (${vcp})`} expandable={true} input={
                        <div className="input-row"><div style={{ cursor: "pointer" }} onClick={() => deleteFeature(vcp)}>{deleteIcon}</div><div className="inputToggle-generic"><input onChange={() => { props?.toggleFeature(monitor.hwid[1], vcp) }} checked={(enabled ? true : false)} data-checked={(enabled ? true : false)} type="checkbox" /></div></div>
                    }>
                        <SettingsChild>
                            <MonitorFeaturesSettings onChange={onChange} key={vcp + "_settings"} enabled={enabled} settings={settings} hwid={monitor?.hwid?.[1]} T={T} vcp={vcp} />
                        </SettingsChild>
                    </SettingsOption>
                )
            }
        }

        // VCP code list
        if (monitor.vcpCodes && typeof monitor.vcpCodes === 'object' && Object.values(monitor.vcpCodes).length) {
            const list = []
            for (const code in monitor.vcpCodes) {
                list.push(
                    <div className="vcp-code" key={code}><b>{code}</b>: {findVCPCodeName(code) || "???"}
                        {
                            monitor.vcpCodes[code].length
                                ? <div className="supported-values">{T.t("SETTINGS_FEATURES_VCP_EXPECTED")}: {monitor.vcpCodes[code].toString()}</div>
                                : ""
                        }
                    </div>
                )
            }
            if (list) {
                extraHTML.push(
                    <SettingsOption className="monitor-feature-item" key={"vcp-codes"} description={T.t("SETTINGS_FEATURES_VCP_LIST_TITLE")} expandable={true} forceExpandable={true}>
                        <SettingsChild>
                            <div className="detected-vcp-codes">
                                <div className="vcp-code">⚠️ {T.t("SETTINGS_FEATURES_VCP_LIST_DESC")}<br /><br /></div>
                                {list}
                            </div>
                        </SettingsChild>
                    </SettingsOption>
                )
            }
        }

        extraHTML.push(
            <div className="input-row" key="add">
                <p><a onClick={() => { props.onAddFeature() }} className="button">+ {T.t("SETTINGS_FEATURES_ADD")}</a></p>
            </div>
        )

    } else {
        extraHTML.push(<p key="none">{T.t("SETTINGS_FEATURES_UNSUPPORTED")}</p>)
    }

    return (
        <div key={monitor.key}>
            <br />
            <div className="sectionSubtitle"><div className="icon">&#xE7F4;</div><div>{monitor.name}</div></div>
            {extraHTML}
        </div>
    )
}

function MonitorFeaturesSettings(props) {
    const { enabled, settings, hwid, vcp, onChange, T } = props
    //if(!enabled) return (<></>);

    const [settingsObj, updateSettings] = useObject(Object.assign({
        icon: "e897",
        iconType: "windows",
        iconText: "",
        iconPath: "",
        min: 0,
        max: 100,
        maxVisual: 100,
        linked: false
    }, settings))

    const onChangeHandler = (settingName, value) => {
        try {
            updateSettings({ [settingName]: value })
            if (!window.settings.monitorFeaturesSettings[hwid]) {
                window.settings.monitorFeaturesSettings[hwid] = {}
            }
            if (!window.settings.monitorFeaturesSettings[hwid][vcp]) {
                window.settings.monitorFeaturesSettings[hwid][vcp] = {}
            }
            window.settings.monitorFeaturesSettings[hwid][vcp][settingName] = value
            if (onChange) onChange(settingName, value);
        } catch (e) {
            console.log(e)
        }
    }

    const iconType = (
        <div className="field">
            <label>{T.t("GENERIC_SLIDER_INDICATOR_TYPE")}</label>
            <select value={settingsObj.iconType} onChange={e => onChangeHandler("iconType", e.target.value)} style={{ flex: "0.65" }}>
                <option value="windows">{T.t("GENERIC_ICON")}</option>
                <option value="text">{T.t("GENERIC_TEXT")}</option>
            </select>
        </div>
    )

    const icon = (
        <div className="field">
            <label>{T.t("GENERIC_SLIDER_ICON")}</label>
            <select style={{ fontFamily: `"Segoe Fluent Icons", "Segoe MDL2 Assets"` }} value={settingsObj.icon} onChange={e => onChangeHandler("icon", e.target.value)}>
                <WindowsIconsOptions />
            </select>
        </div>
    )

    const iconText = (
        <div className="field">
            <label>{T.t("GENERIC_SLIDER_TEXT")}</label>
            <input type="text" value={settingsObj.iconText} onChange={e => onChangeHandler("iconText", e.target.value)} placeholder={T.t("GENERIC_SLIDER_NAME")} />
        </div>
    )

    const iconSettings = (
        <div className="input-row">
            {iconType}
            {settingsObj.iconType === "windows" ? icon : null}
            {settingsObj.iconType === "text" ? iconText : null}
        </div>
    )

    return (
        <div className="feature-toggle-settings">
            {ignoreCodes.indexOf(vcp) === -1 ? iconSettings : null}
            <div className="input-row">
                <Slider min={0} max={100} name={T.t("GENERIC_MINIMUM")} onChange={value => onChangeHandler("min", value)} level={settingsObj.min} scrolling={false} height={"short"} icon={false} />
                <Slider min={0} max={100} name={T.t("GENERIC_MAXIMUM")} onChange={value => onChangeHandler("max", value)} level={settingsObj.max} scrolling={false} height={"short"} icon={false} />
            </div>
            <div className="input-row">
                <div className="feature-toggle-row">
                    <input onChange={e => onChangeHandler("linked", e.target.checked)} checked={(settingsObj.linked ? true : false)} data-checked={(settingsObj.linked ? true : false)} type="checkbox" />
                    <div className="feature-toggle-label"><span>{T.t("SETTINGS_FEATURES_LINKED_TO_BRIGHTNESS")}</span></div>
                </div>
            </div>
            <div style={{ display: (settingsObj.linked ? "block" : "none") }}>
                <br />
                <Slider min={0} max={100} name={T.t("SETTINGS_FEATURES_STOP_ON_BRIGHTNESS")} onChange={value => onChangeHandler("maxVisual", value)} level={settingsObj.maxVisual ?? 100} scrolling={false} height={"short"} icon={false} />
            </div>
        </div>
    )
}

/**
 * Component for setting a custom VCP code for brightness control.
 * 
 * This component allows the user to specify a custom VCP (Virtual Control Panel) code
 * for controlling monitor brightness. The expected format for VCP codes is a hexadecimal
 * string (e.g., "0x10", "0x6B"). The setting is persisted in the application's settings
 * under `userDDCBrightnessVCPs` and applied immediately via `window.sendSettings`.
 * 
 * @param {Object} props - Component props
 * @param {string} props.hwid - Hardware ID of the monitor
 * @param {string} props.currentBrightnessVCP - Current custom VCP code (hex string like "0x10")
 * @param {Object} props.T - Translation object
 */
function BrightnessFeatureSettings(props) {
    const { hwid, currentBrightnessVCP, T } = props

    const [vcpInput, setVcpInput] = useState(currentBrightnessVCP)

    // Sync input value when settings change externally
    useEffect(() => {
        setVcpInput(currentBrightnessVCP)
    }, [currentBrightnessVCP])

    const handleVCPChange = (e) => {
        const value = e.target.value.trim()
        setVcpInput(value)
        
        const newUserVCPs = Object.assign({}, window.settings?.userDDCBrightnessVCPs || {})
        if (value === "") {
            delete newUserVCPs[hwid]
        } else {
            // Validate the input is a valid hex VCP code (0x00-0xFF)
            const parsed = parseInt(value, 16)
            if (isNaN(parsed) || parsed < 0 || parsed > 0xFF) {
                // Invalid input - don't save, just update the input field
                return
            }
            newUserVCPs[hwid] = value
        }
        window.sendSettings({ userDDCBrightnessVCPs: newUserVCPs })
    }

    return (
        <div className="feature-toggle-settings">
            <p className="description" style={{ marginBottom: "12px", opacity: 0.8, fontSize: "12px" }}>
                {T.t("SETTINGS_FEATURES_BRIGHTNESS_VCP_INFO")}
            </p>
            <div className="input-row">
                <div className="field" style={{ flex: 1 }}>
                    <label>{T.t("SETTINGS_FEATURES_ADD_VCP")}</label>
                    <input type="text" value={vcpInput} onChange={handleVCPChange} placeholder="0x10" style={{ maxWidth: "120px" }} />
                </div>
            </div>
            <p className="description" style={{ marginTop: "8px", opacity: 0.7, fontSize: "12px" }}>
                {T.t("SETTINGS_FEATURES_BRIGHTNESS_VCP_DESC")}
            </p>
        </div>
    )
}

const windowsIcons = [
    "e897",
    "e706",
    "e70c",
    "e71d",
    "e727",
    "e733",
    "e734",
    "e73a",
    "e772",
    "e767",
    "e760",
    "e761",
    "e781",
    "e783",
    "e793",
    "e794",
    "e7a1",
    "e7b3",
    "e7e8",
    "e7f4",
    "e7f7",
    "e82f",
    "e836",
    "ea61",
    "ea80",
    "eb67",
    "ebaa",
    "edb1",
    "edb5",
    "f08c",
    "f093",
    "f094",
    "f095",
    "f096",
    "f0ce",
    "f1db",
    "f1e8",
    "f4a5",
    "f736",
    "f78b",
    "f785",
    "f78d",
    "f0b2",
    "e8be",
    "e88e",
    "e839",
    "e7fc",
    "e78b",
    "e713",
    "eb9f",
    "ed39",
    "ed3a"
]

function WindowsIconsOptions(props) {
    return windowsIcons.map(icon => {
        return (<option style={{ fontFamily: `"Segoe Fluent Icons", "Segoe MDL2 Assets"`, fontSize: "18px" }} key={icon} value={icon} dangerouslySetInnerHTML={{ __html: `&#x${icon};` }}></option>)
    })
}

function findVCPCodeName(code) {
    for (const name in VCP) {
        if (VCP[name] == code) {
            return name
        }
    }
    return false
}


================================================
FILE: src/components/MonitorInfo.jsx
================================================
import React, { useState, useEffect } from "react"
import Slider from "./Slider"
import TranslateReact from "../TranslateReact"

export default function MonitorInfo(props) {
    const { monitor, name } = props
    const [brightness, setBrightness] = useState(monitor?.features?.["0x10"] ? monitor?.features?.["0x10"][0] : 50)
    const [contrast, setContrast] = useState(monitor?.features?.["0x12"] ? monitor?.features?.["0x12"][0] : 50)
    const [volume, setVolume] = useState(monitor?.features?.["0x62"] ? monitor?.features?.["0x62"][0] : 50)
    const [powerState, setPowerState] = useState(monitor?.features?.["0xD6"] ? monitor?.features?.["0xD6"][0] : 50)
    const [sdr, setSDR] = useState(monitor.sdrLevel >= 0 ? monitor.sdrLevel : 50)
    const [manualVCP, setManualVCP] = useState("")
    const [manualValue, setManualValue] = useState("")
    const [T] = useState(new TranslateReact({}, {}))

    let extraHTML = []

    useEffect(() => {
        window.addEventListener("localizationUpdated", (e) => T.setLocalizationData(e.detail.desired, e.detail.default))
        window.ipc.send('request-localization')
        return () => { }
    }, [])

    if (props.debug === true) {
        extraHTML.push(
            <div key="debug">
                <br />Raw Brightness: <b>{(monitor.type == "none" ? "Not supported" : monitor.brightnessRaw)}</b>
                <br />Features: <b>{(monitor.type == "ddcci" && monitor.features ? JSON.stringify(monitor.features) : "Unsupported")}</b>
                <br />Order: <b>{(monitor.order ? monitor.order : "0")}</b>
                <br />Key: <b>{monitor.key}</b>
                <br />ID: <b>{monitor.id}</b>
                <br />Connection Type: <b>{monitor.connector}</b>
                <br /><br />
            </div>
        )
    }

    // Brightness
    if (monitor?.features?.["0x10"]) {
        extraHTML.push(
            <div className="feature-row" key="brightness">
                <div className="feature-icon"><span className="icon vfix">&#xE706;</span></div>
                <Slider type="brightness" monitorID={monitor.id} level={brightness} monitorName={monitor.name} monitortype={monitor.type} onChange={val => { setBrightness(val); setVCP(monitor.id, 0x10, val * (monitor.features["0x10"][1] / 100)) }} scrolling={false} />
            </div>
        )
    }

    // Contrast
    if (monitor?.features?.["0x12"]) {
        extraHTML.push(
            <div className="feature-row" key="contrast">
                <div className="feature-icon"><span className="icon vfix">&#xE793;</span></div>
                <Slider type="contrast" monitorID={monitor.id} level={contrast} monitorName={monitor.name} monitortype={monitor.type} onChange={val => { setContrast(val); setVCP(monitor.id, 0x12, val * (monitor.features["0x12"][1] / 100)) }} scrolling={false} />
            </div>
        )
    }

    // Volume
    if (monitor?.features?.["0x62"]) {
        extraHTML.push(
            <div className="feature-row" key="volume">
                <div className="feature-icon"><span className="icon vfix">&#xE767;</span></div>
                <Slider type="volume" monitorID={monitor.id} level={volume} monitorName={monitor.name} monitortype={monitor.type} onChange={val => { setVolume(val); setVCP(monitor.id, 0x62, val * (monitor.features["0x62"][1] / 100)) }} scrolling={false} />
            </div>
        )
    }

    // Power State
    if (monitor?.features?.["0xD6"]) {
        extraHTML.push(
            <div className="feature-row" key="powerState">
                <div className="feature-icon"><span className="icon vfix">&#xE7E8;</span></div>
                <Slider type="powerState" monitorID={monitor.id} level={powerState} monitorName={monitor.name} max={monitor.features["0xD6"][1]} monitortype={monitor.type} onChange={val => { setPowerState(val); setVCP(monitor.id, 0xD6, val) }} scrolling={false} />
            </div>
        )
    }

    // Manual VCP
    extraHTML.push(
        <div className="manual-vcp-row" key="manual">
            <input placeholder="VCP code" value={manualVCP} onChange={e => { setManualVCP(e.target.value) }} />
            <input placeholder="Value" value={manualValue} onChange={e => { setManualValue(e.target.value) }} />
            <a className="button" onClick={() => setVCP(monitor.id, parseInt(manualVCP), parseInt(manualValue))}>Send VCP</a>
        </div>
    )

    // SDR test
    extraHTML.push(
        <div className="feature-row" key="sdrLevel">
            <div className="feature-icon">SDR</div>
            <Slider type="sdrLevel" monitorID={monitor.id} level={sdr} monitorName={monitor.name} max={100} monitortype={monitor.type} onChange={val => { setSDR(val); setSDRBrightness(monitor.id, val) }} scrolling={false} />
        </div>
    )

    return (
        <div key={monitor.key}>
            <br />
            <div className="sectionSubtitle"><div className="icon">&#xE7F4;</div><div>{monitor.name}</div></div>
            <p>{T.t("SETTINGS_MONITORS_DETAILS_NAME")}: <b>{name}</b>
                <br />{T.t("SETTINGS_MONITORS_DETAILS_INTERNAL_NAME")}: <b>{monitor.hwid[1]}</b>
                <br />{T.t("SETTINGS_MONITORS_DETAILS_COMMUNICATION")}: {getDebugMonitorType((monitor.type === "ddcci" && monitor.highLevelSupported?.brightness ? "ddcci-hl" : monitor.type))}
                <br />{T.t("SETTINGS_MONITORS_DETAILS_BRIGHTNESS")}: <b>{(monitor.type == "none" ? T.t("GENERIC_NOT_SUPPORTED") : monitor.brightness)}</b>
                <br />{T.t("SETTINGS_MONITORS_DETAILS_MAX_BRIGHTNESS")}: <b>{(monitor.type !== "ddcci" ? T.t("GENERIC_NOT_SUPPORTED") : monitor.brightnessMax)}</b>
                <br />{T.t("SETTINGS_MONITORS_DETAILS_BRIGHTNESS_NORMALIZATION")}: <b>{(monitor.type == "none" ? T.t("GENERIC_NOT_SUPPORTED") : monitor.min + " - " + monitor.max)}</b>
                <br />{T.t("SETTINGS_MONITORS_DETAILS_HDR")}: <b>{(monitor.hdr == "active" ? T.t("GENERIC_ACTIVE") : monitor.hdr == "supported" ? T.t("GENERIC_SUPPORTED") : T.t("GENERIC_UNSUPPORTED"))}</b>
            </p>
            {extraHTML}
        </div>
    )
}

function setVCP(monitor, code, value) {
    window.dispatchEvent(new CustomEvent("setVCP", {
        detail: {
            monitor,
            code,
            value
        }
    }))
}

function setSDRBrightness(monitor, value) {
    window.dispatchEvent(new CustomEvent("set-sdr-brightness", {
        detail: {
            monitor,
            value
        }
    }))
}

function getDebugMonitorType(type) {
    if (type == "none") {
        return (<><b>None</b> <span className="icon red vfix">&#xEB90;</span></>)
    } else if (type == "ddcci") {
        return (<><b>DDC/CI</b> <span className="icon green vfix">&#xE73D;</span></>)
    } else if (type == "ddcci-hl") {
        return (<><b>DDC/CI (HL)</b> <span className="icon green vfix">&#xE73D;</span></>)
    } else if (type == "wmi") {
        return (<><b>WMI</b> <span className="icon green vfix">&#xE73D;</span></>)
    } else if (type == "studio-display") {
        return (<><b>Studio Display</b> <span className="icon green vfix">&#xE73D;</span></>)
    } else {
        return (<><b>Unknown ({type})</b> <span className="icon red vfix">&#xEB90;</span></>)
    }
}


================================================
FILE: src/components/SafeRender.jsx
================================================
import React from "react";

export default class SafeRender extends React.Component {
    constructor(props) {
      super(props);
      this.state = { hasError: false, error: "" };
    }
  
    static getDerivedStateFromError(error) {
      return { hasError: true, error: error };
    }
  
    componentDidCatch(error, errorInfo) {
      console.log(error)
      this.setState({
          hasError: true,
          error: error,
          errorInfo: errorInfo?.componentStack
        })
    }
  
    render() {
      if (this.state.hasError) {
        return (<pre className="try-catch-failure">Error: {JSON.stringify(this.state.error)}<br />{this.state.errorInfo}</pre>);
      }
  
      return <>{this.props?.children}</>; 
    }
  }

================================================
FILE: src/components/SettingsOption.jsx
================================================
import React, { useState, useEffect } from "react"
import SafeRender from "./SafeRender"

export function SettingsOption(props) {
    const [expanded, setExpanded] = useState((props.startExpanded ?? false))

    const title = (props.title ? <div className="option-title">{props.title}</div> : null)
    const icon = (props.icon ? <div className="option-icon icon" dangerouslySetInnerHTML={{ __html: `&#x${props.icon};` }}></div> : null)
    const description = (props.description ? <div className="option-description">{props.description}</div> : null)
    const elem = (props.content ? <div className="option-elem">{props.content}</div> : null)
    const input = (props.input ? <div className="input-area">{props.input}</div> : null)
    const className = `settings-option-elem ${props.className ?? ""}`

    return (
        <SafeRender>
            <div className={className} data-expandable={props.expandable} data-force-expandable={props.forceExpandable ?? false} data-expanded={expanded}>
                <div className="parent-panel">
                    {icon}
                    <div className="content-area">
                        {title}
                        {description}
                        {elem}
                    </div>
                    {input}
                    <div className="expand" onClick={() => setExpanded(!expanded)}><div className="icon">&#xE70D;</div></div>
                </div>
                <div className="settings-option-children">
                    <div className="children-inner">
                        {props.children}
                    </div>
                </div>
            </div>
        </SafeRender>
    )
}

export function SettingsChild(props) {
    const title = (props.title ? <div className="child-option-title">{props.title}</div> : null)
    const icon = (props.icon ? <div className="option-icon icon" dangerouslySetInnerHTML={{ __html: `&#x${props.icon};` }}></div> : null)
    const description = (props.description ? <div className="child-option-description">{props.description}</div> : null)
    const elem = (props.content ? <div className="option-elem">{props.content}</div> : null)
    const children = (props.children ? <div className="option-elem">{props.children}</div> : null)
    const input = (props.input ? <div className="input-area">{props.input}</div> : null)
    const className = `settings-child-elem ${props.className ?? ""}`
    return Array.isArray(props.children)
        ?
        <div>
            {children}
        </div>

        :
        <div className={className}>
            <div className="child-panel">
                {icon}
                <div className="content-area">
                    {title}
                    {description}
                    {elem}
                    {children}
                </div>
                {input}
            </div>
        </div>

}

================================================
FILE: src/components/SettingsWindow.jsx
================================================
/*

Hi,
If you're reading this, you probably want to know how this component works.
This component is not good. Mistakes were made.
It's a horrible bowl of spaghetti.
Run while you still can.

*/

import React, { PureComponent } from "react";
import Titlebar from './Titlebar'
import Slider from "./Slider";
import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
import Markdown from 'markdown-to-jsx';
import TranslateReact from "../TranslateReact"
import MonitorInfo from "./MonitorInfo"
import MonitorFeatures from "./MonitorFeatures"
import { SettingsOption, SettingsChild } from "./SettingsOption";
import SafeRender from "./SafeRender";

import DefaultIcon from "../assets/tray-icons/dark/icon@4x.png"
import MDL2Icon from "../assets/tray-icons/dark/mdl2@4x.png"
import FluentIcon from "../assets/tray-icons/dark/fluent@4x.png"

function vcpStr(code) {
    return `0x${parseInt(code).toString(16).toUpperCase()}`
}

const uuid = () => crypto.randomUUID()

const reorder = (list, startIndex, endIndex) => {
    const result = Array.from(list);
    const [removed] = result.splice(startIndex, 1);
    result.splice(endIndex, 0, removed);
    return result;
};

const getItemStyle = (isDragging, draggableStyle) => ({
    userSelect: "none",
    background: isDragging ? "rgba(122, 122, 122, 0.2)" : "none",
    ...draggableStyle
});

const monitorSort = (a, b) => {
    const aSort = (a.order === undefined ? 999 : a.order * 1)
    const bSort = (b.order === undefined ? 999 : b.order * 1)
    return aSort - bSort
}

const deleteIcon = (<span className="icon" dangerouslySetInnerHTML={{ __html: "&#xE74D;" }}></span>)

const cleanUpKeyboardKeys = (inKey, inCode = false) => {
    let key = inKey
    let code = inCode

    if (key.length == 1) {
        key = key.toUpperCase()
    }

    switch (key) {
        case "Meta":
            key = "Super";
            break;
        case " ":
            key = "Space";
            break;
        case "ArrowUp":
            key = "Up";
            break;
        case "ArrowDown":
            key = "Down";
            break;
        case "ArrowLeft":
            key = "Left";
            break;
        case "ArrowRight":
            key = "Right";
            break;
        case "+":
            key = "Plus";
            break;
        case "-":
            key = "Minus";
            break;
    }

    if (code >= 96 && code <= 105) key = "num" + (code - 96);

    switch (code) {
        case 106: key = "nummult"; break;
        case 107: key = "numadd"; break;
        case 109: key = "numsub"; break;
        case 110: key = "numdec"; break;
        case 111: key = "numdiv"; break;
    }

    return key;
}

const defaultAction = {
    type: "set",
    target: "brightness",
    monitors: {},
    allMonitors: false,
    value: 0,
    values: [0],
    id: uuid()
}

let T = new TranslateReact({}, {})

export default class SettingsWindow extends PureComponent {

    constructor(props) {
        super(props)
        this.state = {
            rawSettings: {},
            activePage: "general",
            theme: 'default',
            openAtLogin: false,
            brightnessAtStartup: true,
            monitors: [],
            remaps: [],
            names: [],
            hotkeys: [],
            adjustmentTimes: [],
            linkedLevelsActive: false,
            updateInterval: (window.settings.updateInterval || 500),
            downloadingUpdate: false,
            checkForUpdates: false,
            adjustmentTimeIndividualDisplays: false,
            languages: [],
            analytics: false,
            useAcrylic: true,
            scrollShortcut: true,
            updateProgress: 0,
            extendedDDCCI: {
                contrast: 50,
                volume: 50,
                powerState: 0
            },
            windowHistory: [],
            showAddFeatureOverlay: false,
            addFeatureMonitor: "",
            addFeatureValue: "",
            addFeatureError: false
        }
        this.numMonitors = 0
        this.downKeys = {}
        this.lastLevels = []
        this.onDragEnd = this.onDragEnd.bind(this);
        this.sendSettingsTimeout = false
        this.sendSettingsValues = {}
        this.settingsPageRef = React.createRef()
        this.addFeatureInputRef = React.createRef()
        this.addFeatureOKRef = React.createRef()
        this.addFeatureCancelRef = React.createRef()
    }

    sendSettingsThrottle = (newSetting = {}) => {
        this.sendSettingsValues = Object.assign(this.sendSettingsValues, newSetting)
        if (this.sendSettingsTimeout) {
            clearTimeout(this.sendSettingsTimeout)
        }
        this.sendSettingsTimeout = setTimeout(() => {
            window.sendSettings(Object.assign({}, this.sendSettingsValues))
            this.sendSettingsValues = {}
        }, 2000)
    }

    componentDidMount() {
        window.addEventListener("monitorsUpdated", this.recievedMonitors)
        window.addEventListener("settingsUpdated", this.recievedSettings)
        window.addEventListener("localizationUpdated", (e) => { this.setState({ languages: e.detail.languages });  T.setLocalizationData(e.detail.desired, e.detail.default)}); 
        window.addEventListener("windowHistory", e => this.setState({ windowHistory: e.detail }))

        if (window.isAppX === false) {
            window.addEventListener("updateUpdated", (e) => {
                const version = e.detail
                this.setState({
                    releaseURL: (window.isAppX ? "ms-windows-store://pdp/?productid=9PLJWWSV01LK" : version.releaseURL),
                    latest: version.version,
                    downloadURL: version.downloadURL,
                    changelog: version.changelog,
                    error: (version.error != undefined ? version.error : false)
                })
                if (e.detail.error == true) {
                    this.setState({
                        downloadingUpdate: false
                    })
                }
            })
            window.addEventListener("updateProgress", (e) => {
                this.setState({
                    updateProgress: e.detail.progress
                })
            })
            window.checkForUpdates()
        }
        window.ipc.send('get-window-history')
        window.ipc.send("sendSettingsWindowPos")
        window.ipc.send('request-localization')
        window.reactReady = true
    }



    onDragEnd(result) {
        // dropped outside the list
        if (!result.destination) {
            return;
        }
        const sorted = Object.values(this.state.monitors).slice(0).sort(monitorSort)
        const items = reorder(
            sorted,
            result.source.index,
            result.destination.index
        );

        let order = []
        let idx = 0
        for (let monitor of items) {
            this.state.monitors[monitor.key].order = idx
            order.push({
                id: monitor.id,
                order: idx
            })
            idx++
        }

        this.setState({
            order
        });

        window.sendSettings({ order })
    }



    getRemap = (name) => {
        if (this.state.remaps[name] === undefined) {
            return {
                isFallback: true,
                min: 0,
                max: 100,
                calibration: []
            }
        }
        return this.state.remaps[name]
    }


    minMaxChanged = (value, slider) => {

        const name = slider.props.monitorID
        let remaps = Object.assign({}, this.state.remaps)

        if (remaps[name] === undefined) {
            remaps[name] = {
                min: 0,
                max: 100,
                calibration: []
            }
        }

        if (slider.props.type == "min") {
            remaps[name].min = value

            // Keep within 10%, cap

            if (remaps[name].min > remaps[name].max - 10) {
                remaps[name].max = remaps[name].min + 10
            }

            if (remaps[name].max > 100) {
                remaps[name].max = 100
            }

            if (remaps[name].min > remaps[name].max - 10) {
                remaps[name].min = remaps[name].max - 10
            }

        } else if (slider.props.type == "max") {
            remaps[name].max = value

            // Keep within 10%, cap

            if (remaps[name].min > remaps[name].max - 10) {
                remaps[name].min = remaps[name].max - 10
            }

            if (remaps[name].min < 0) {
                remaps[name].min = 0
            }

            if (remaps[name].min > remaps[name].max - 10) {
                remaps[name].max = remaps[name].min + 10
            }
        }

        const oldData = JSON.stringify(this.state.remaps);
        const newData = JSON.stringify(remaps);
        const hasChanged = (oldData == newData ? false : true);
        //if(!hasChanged) return false;
        this.setState({ remaps })
        window.sendSettings({ remaps })
    }

    themeChanged = (event) => {
        this.setState({ theme: event.target.value })
        window.sendSettings({ theme: event.target.value })
    }

    updateIntervalChanged = (event) => {
        this.setState({ updateInterval: event.target.value * 1 })
        window.sendSettings({ updateInterval: event.target.value * 1 })
    }

    sleepActionChanged = (event) => {
        window.sendSettings({ sleepAction: event.target.value })
    }

    monitorNameChange = (e, f) => {
        const idx = e.currentTarget.dataset.key
        this.state.names[window.allMonitors[idx].id] = e.currentTarget.value
        this.forceUpdate()
        window.sendSettings({ names: this.state.names })
    }

    getMonitorName = (monitor, renames) => {
        if (Object.keys(renames).indexOf(monitor.id) >= 0 && renames[monitor.id] != "") {
            return renames[monitor.id] + ` (${monitor.name})`
        } else {
            return monitor.name
        }
    }

    getSidebar = () => {
        const items = [
            {
                id: "general",
                label: T.t("SETTINGS_SIDEBAR_GENERAL"),
                icon: "&#xE713;"
            },
            {
                id: "monitors",
                label: T.t("SETTINGS_SIDEBAR_MONITORS"),
                icon: "&#xE7F4;"
            },
            {
                id: "features",
                label: T.t("SETTINGS_SIDEBAR_FEATURES"),
                icon: "&#xE9E9;"
            },
            {
                id: "time",
                label: T.t("SETTINGS_SIDEBAR_TIME"),
                icon: "&#xE823;"
            },
            {
                id: "hotkeys",
                label: T.t("SETTINGS_SIDEBAR_HOTKEYS"),
                icon: "&#xF210;"
            },
            {
                id: "updates",
                label: T.t("SETTINGS_SIDEBAR_UPDATES"),
                icon: "&#xE895;"
            },
            {
                id: "debug",
                label: "Debug",
                icon: "&#xEBE8;",
                type: "debug"
            }
        ]
        return items.map((item, index) => {
            return (<div key={item.id} className="item" data-active={this.isSection(item.id)} data-type={item.type || "none"} onClick={() => { this.setState({ activePage: item.id }); window.currentSettingsPage = item.id; this.scrollToTop(); window.reloadReactMonitors(); window.requestMonitors(); }}>
                <div className="icon" dangerouslySetInnerHTML={{ __html: (item.icon || "&#xE770;") }}></div><div className="label">{item.label || `Item ${index}`}</div>
            </div>)
        })
    }


    getLanguages = () => {
        if (this.state.languages && this.state.languages.length > 0) {
            return this.state.languages.map((value, index) => {
                return (<option key={value.id} value={value.id}>{value.name}</option>)
            })
        }
    }

    scrollToTop = () => {
        try {
            this.settingsPageRef.current.scrollTop = 0
        } catch(e) { }
    }


    getUpdate = () => {
        if (window.isAppX) {
            return (
                <p><a onClick={() => { window.openURL("ms-store") }}>{T.t("SETTINGS_UPDATES_MS_STORE")}</a></p>
            )
        } else {
            if (this.state.latest && this.state.latest != window.version) {
                return (
                    <div>
                        <p><b style={{ color: window.accent }}>{T.t("SETTINGS_UPDATES_AVAILABLE") + ` (${this.state.latest})`}</b></p>
                        <div className="changelog">
                            <h3>{this.state.latest}</h3>
                            <Markdown options={{ forceBlock: true }}>{this.state.changelog}</Markdown>
                        </div>
                        <br />
                        {this.getUpdateButton()}
                    </div>
                )
            } else if (this.state.latest) {
                return (
                    <div>
                        <p>{T.t("SETTINGS_UPDATES_NONE_AVAILABLE")}</p>
                        <div className="changelog"><Markdown options={{ forceBlock: true }}>{this.state.changelog}</Markdown></div>
                    </div>
                )
            }
        }
    }

    getUpdateButton = () => {
        if (this.state.downloadingUpdate) {
            return (<div><p><b>{T.t("SETTINGS_UPDATES_DOWNLOADING")}</b></p><div className="progress-bar"><div style={{ width: `${this.state.updateProgress}%` }}></div></div></div>)
        } else {
            return (<a className="button" onClick={() => { window.getUpdate(); this.setState({ downloadingUpdate: true }) }}><span className="icon red vfix" style={{ paddingRight: "6px", display: (this.state.error ? "inline" : "none") }}>&#xE783;</span>{T.t("SETTINGS_UPDATES_DOWNLOAD", this.state.latest)}</a>)
        }
    }

    getMinMaxMonitors = () => {
        if (this.state.monitors == undefined || Object.keys(this.state.monitors).length == 0) {
            return (<div className="no-displays-message">{T.t("GENERIC_NO_COMPATIBLE_DISPLAYS")}<br /><br /></div>)
        } else {
            return Object.values(this.state.monitors).map((monitor, index) => {
                if (monitor.type == "none") {
                    return (<div key={monitor.name}></div>)
                } else {
                    // New method, by ID
                    let remap = this.getRemap(monitor.id)
                    // Old method, by name
                    if (remap.isFallback) {
                        remap = this.getRemap(monitor.name)
                    }
                    return (
                        <SettingsOption key={monitor.id} icon="E7F4" title={getMonitorName(monitor, this.state.names)}>
                            <SettingsChild content={
                                <div className="input-row">
                                    <div className="monitor-item">
                                        <label>{T.t("GENERIC_MINIMUM")}</label>
                                        <Slider key={monitor.id + ".min"} type="min" monitorID={monitor.id} level={remap.min} monitorName={monitor.name} monitortype={monitor.type} onChange={this.minMaxChanged} scrolling={false} height={"short"} />
                                    </div>
                                    <div className="monitor-item">
                                        <label>{T.t("GENERIC_MAXIMUM")}</label>
                                        <Slider key={monitor.id + ".max"} type="max" monitorID={monitor.id} level={remap.max} monitorName={monitor.name} monitortype={monitor.type} onChange={this.minMaxChanged} scrolling={false} height={"short"} />
                                    </div>
                                </div>
                            } />
                            <SettingsChild content={
                                <div className="calibration-points-menu">
                                    { this.getMonitorCalibration(monitor.id) }
                                    <div className="input-row">
                                        <div className="button" onClick={() => this.addCalibrationPoint(monitor.id)}>+ {T.t("GENERIC_CALIBRATION_POINT")}</div>
                                    </div>
                                </div>
                            } />
                        </SettingsOption>

                    )
                }
            })
        }
    }

    getMonitorCalibration = (monitorID) => {
        const pointsElems = []

        const remap = this.getRemap(monitorID)

        if(remap) for(const pointIdx in remap.calibration) {
            const point = remap.calibration[pointIdx]

            pointsElems.push(
                <div className="input-row" key={pointIdx}>
                    <div className="monitor-item">
                        <label>Input</label>
                        <Slider level={point.input} onChange={(value) => this.updateCalibrationPoint(monitorID, pointIdx, "input", value)} scrolling={false} height={"short"} />
                    </div>
                    <div className="monitor-item">
                        <label>Output</label>
                        <Slider level={point.output} onChange={(value) => this.updateCalibrationPoint(monitorID, pointIdx, "output", value)} scrolling={false} height={"short"} />
                    </div>
                    <div style={{ display: "flex", alignItems: "flex-end" }}>
                        <a className="add-new button button-primary block" onClick={() => this.deleteCalibrationPoint(monitorID, pointIdx)}>{ deleteIcon } <span>{T.t("GENERIC_DELETE")}</span></a>
                    </div>
                </div>
            )
        }
        return pointsElems
    }

    addCalibrationPoint = (monitorID) => {
        if (this.state.remaps[monitorID] === undefined) {
            this.state.remaps[monitorID] = {
                min: 0,
                max: 100,
                calibration: []
            }
        }

        const remap = this.getRemap(monitorID)
        if(remap) {
            if(!remap.calibration) remap.calibration = [];
            remap.calibration.push({ input: 0, output: 100 })
            this.setState({ remaps: { ...this.state.remaps } })
            window.sendSettings({ remaps: this.state.remaps })
        }
    }

    updateCalibrationPoint = (monitorID, pointIdx, field, value) => {
        const remap = this.getRemap(monitorID)
        if(remap && remap.calibration[pointIdx]) {
            remap.calibration[pointIdx][field] = value
            this.setState({ remaps: { ...this.state.remaps } })
            window.sendSettings({ remaps: this.state.remaps })
        }
    }

    deleteCalibrationPoint = (monitorID, pointIdx) => {
        const remap = this.getRemap(monitorID)
        if(remap && remap.calibration[pointIdx]) {
            remap.calibration.splice(pointIdx, 1)
            this.setState({ remaps: { ...this.state.remaps } })
            window.sendSettings({ remaps: this.state.remaps })
        }
    }

    getRenameMonitors = () => {
        if (this.state.monitors == undefined || Object.keys(this.state.monitors).length == 0) {
            return (<SettingsChild content={<div className="no-displays-message">{T.t("GENERIC_NO_COMPATIBLE_DISPLAYS")}<br /><br /></div>} />)
        } else {
            return Object.values(this.state.monitors).map((monitor, index) => {
                if (monitor.type == "none") {
                    return null
                } else {
                    return (
                        <SettingsChild key={monitor.id} icon="E7F4" title={monitor.name} input={(
                            <input type="text" placeholder={T.t("SETTINGS_MONITORS_ENTER_NAME")} data-key={monitor.key} onChange={this.monitorNameChange} value={(this.state.names[monitor.id] ? this.state.names[monitor.id] : "")}></input>
                        )} />
                    )
                }
            })
        }
    }


    getReorderMonitors = () => {
        if (this.state.monitors == undefined || this.numMonitors == 0) {
            return (<div className="no-displays-message">{T.t("GENERIC_NO_COMPATIBLE_DISPLAYS")}<br /><br /></div>)
        } else {
            const sorted = Object.values(this.state.monitors).slice(0).sort(monitorSort)
            return (
                <DragDropContext onDragEnd={this.onDragEnd}>
                    <Droppable droppableId="droppable">
                        {(provided, snapshot) => (
                            <div
                                {...provided.droppableProps}
                                ref={provided.innerRef}
                            >
                                {sorted.map((monitor, index) => {
                                    if (monitor.type == "none") {
                                        return (<div key={monitor.id}></div>)
                                    } else {
                                        return (
                                            <Draggable key={monitor.id} draggableId={monitor.id} index={index}>
                                                {(provided, snapshot) => (
                                                    <div
                                                        ref={provided.innerRef}
                                                        {...provided.draggableProps}
                                                        {...provided.dragHandleProps}
                                                        style={getItemStyle(
                                                            snapshot.isDragging,
                                                            provided.draggableProps.style
                                                        )}
                                                    >
                                                        <div className="sectionSubtitle"><div className="icon">&#xE7F4;</div><div>{getMonitorName(monitor, this.state.names)}</div></div>
                                                    </div>
                                                )}
                                            </Draggable>
                                        )
                                    }
                                })}
                                {provided.placeholder}
                            </div>
                        )}
                    </Droppable>
                </DragDropContext>
            )

        }
    }

    updateAdjustmentTime(time, idx) {
        this.state.adjustmentTimes[idx] = Object.assign({}, time)
        window.sendSettings({ adjustmentTimes: this.state.adjustmentTimes.slice() })
        this.forceUpdate()
    }

    getAdjustmentTimes = () => {
        if (this.state.adjustmentTimes == undefined || this.state.adjustmentTimes.length == 0) {
            return (<div></div>)
        } else {
            const times = window.getSunCalcTimes(window.settings.adjustmentTimeLatitude, window.settings.adjustmentTimeLongitude)
            const lat = parseFloat(window.settings.adjustmentTimeLatitude) ?? 0
            const long = parseFloat(window.settings.adjustmentTimeLongitude) ?? 0
            const canShowSunCalc = ((lat > 0 || lat < 0) && (long > 0 || long < 0))

            return this.state.adjustmentTimes.map((time, index) => {
                let timeElem = (
                    <input type="time" min="00:00" max="23:59" onChange={(e) => {
                        this.setAdjustmentTimeValue(index, e.target.value)
                    }} value={time.time}></input>
                )
                if (time.useSunCalc) {
                    timeElem = (
                        <select value={time.sunCalc ?? "solarNoon"} onChange={e => {
                            time.sunCalc = e.target.value
                            this.updateAdjustmentTime(time, index)
                        }}>
                            <option value="dawn">Dawn ({times.dawn})</option>
                            <option value="sunrise">Sunrise ({times.sunrise})</option>
                            <option value="solarNoon">Solar Noon ({times.solarNoon})</option>
                            <option value="goldenHour">Golden Hour ({times.goldenHour})</option>
                            <option value="sunsetStart">Sunset Start ({times.sunsetStart})</option>
                            <option value="sunset">Sunset ({times.sunset})</option>
                            <option value="dusk">Dusk ({times.dusk})</option>
                            <option value="night">Night ({times.night})</option>
                        </select>
                    )
                }
                return (
                    <SettingsOption className="win10-has-background" key={index + "_" + time.time} content={
                        <div className="input-row">
                            {timeElem}
                            <input type="button" className="button button-primary" value={T.t("SETTINGS_TIME_REMOVE")} onClick={() => {
                                this.state.adjustmentTimes.splice(index, 1)
                                this.forceUpdate()
                                this.adjustmentTimesUpdated()
                            }} />
                        </div>
                    } input={
                        <div className="inputToggle-generic" style={{display: (canShowSunCalc ? "flex" : "none")}}>
                            <input onChange={e => {
                                time.useSunCalc = e.target.checked
                                this.updateAdjustmentTime(time, index)
                            }} checked={time.useSunCalc ?? false} data-checked={time.useSunCalc ?? false} type="checkbox" />
                            <div className="text">{T.t("SETTINGS_TIME_USE_SUN_POSITION")}</div>
                        </div>
                    }>
                        <SettingsChild>
                            {this.getAdjustmentTimesMonitors(time, index)}
                        </SettingsChild>
                    </SettingsOption>
                )
            })
        }

    }

    getAdjustmentTimesMonitors = (time, index) => {
        if (this.state.adjustmentTimeIndividualDisplays) {
            return Object.values(this.state.monitors).map((monitor, idx) => {
                if (monitor.type == "none") {
                    return (<div key={monitor.id + ".brightness"}></div>)
                } else {
                    let level = time.brightness
                    if (this.state.adjustmentTimes[index] && this.state.adjustmentTimes[index].monitors && this.state.adjustmentTimes[index].monitors[monitor.id] >= 0) {
                        level = this.state.adjustmentTimes[index].monitors[monitor.id]
                    } else {
                        // No value set, use shared value
                        this.state.adjustmentTimes[index].monitors[monitor.id] = level
                        this.adjustmentTimesUpdated()
                    }
                    return (<Slider key={monitor.id + ".brightness"} min={0} max={100} name={getMonitorName(monitor, this.state.names)} onChange={(value) => { this.getAdjustmentTimesMonitorsChanged(index, monitor, value) }} level={level} scrolling={false} />)
                }
            })
        } else {
            return (<Slider key={index + ".brightness"} name={T.t("GENERIC_ALL_DISPLAYS")} min={0} max={100} level={time.brightness} onChange={(value, slider) => { this.state.adjustmentTimes[index].brightness = value; this.forceUpdate(); this.adjustmentTimesUpdated() }} scrolling={false} />)
        }
    }

    getAdjustmentTimesMonitorsChanged = (index, monitor, value) => {
        if (this.state.adjustmentTimes[index].monitors === undefined) {
            this.state.adjustmentTimes[index].monitors = {}
        }
        this.state.adjustmentTimes[index].monitors[monitor.id] = value
        this.forceUpdate();
        this.adjustmentTimesUpdated()
    }


    setAdjustmentTimeValue = (index, arr) => {
        for (let i in arr) {
            if (i < 2 && isNaN(arr[i])) return false;
        }
        this.state.adjustmentTimes[index].time = arr

        //this.forceUpdate()
        this.adjustmentTimesUpdated()
    }

    getHotkeyList = () => {

        const deleteHotkeyAction = (idx, actionIdx) => {
            try {
                this.state.hotkeys[idx].actions.splice(actionIdx, 1)
                window.sendSettings({ hotkeys: this.state.hotkeys.slice() })
                this.forceUpdate()
            } catch(e) {
                console.log(e)
            }
        }

        return this.state.hotkeys?.map?.((hotkey, idx) => {
            return (
                <SettingsOption className="win10-has-background" key={hotkey.id} content={
                    <div className="row hotkey-combo-input">
                        <input placeholder={T.t("SETTINGS_HOTKEYS_PRESS_KEYS_HINT")} value={hotkey.accelerator} type="text" readOnly={true} onKeyDown={
                            (e) => {
                                e.preventDefault()
                                let key = cleanUpKeyboardKeys(e.key, e.keyCode)
                                if (this.downKeys[key] === undefined) {
                                    this.downKeys[key] = true;
                                    hotkey.accelerator = Object.keys(this.downKeys).join('+')
                                    this.updateHotkey(hotkey, idx);
                                }
                                return false
                            }
                        } onKeyUp={(e) => { delete this.downKeys[cleanUpKeyboardKeys(e.key, e.keyCode)] }} />
                        <input type="button" value={T.t("GENERIC_CLEAR")} onClick={() => {
                            this.downKeys = {}
                            hotkey.accelerator = ""
                            this.updateHotkey(hotkey, idx);
                        }} />
                        {this.getHotkeyStatusIcon(hotkey)}
                    </div>
                } expandable={true} input={
                    <a className="button button-primary" onClick={() => this.deleteHotkey(idx)}>{ deleteIcon } <span>{T.t("GENERIC_DELETE")}</span></a>
                }>
                    { hotkey.actions?.map((action, actionIdx) => {
                        return (
                            <SettingsChild key={`${idx}-${actionIdx}`}>
                                <ActionItem key={`${idx}-${actionIdx}`} title={`${T.t("SETTINGS_HOTKEY_ACTION")} #${actionIdx + 1}`} action={action} onChange={updatedAction => this.updateHotkeyAction(updatedAction, idx, actionIdx)} onDelete={() => { deleteHotkeyAction(idx, actionIdx) }} monitors={this.state.monitors} monitorNames={this.state.names} />
                            </SettingsChild>
                        )
                    }) }
                    <SettingsChild>
                        <a className="button full-width" onClick={() => {
                            if(!hotkey.actions?.length) {
                                hotkey.actions = []
                            }
                            hotkey.actions.push(Object.assign({}, defaultAction))
                            this.updateHotkey(hotkey, idx)
                        }}>+ {T.t("SETTINGS_HOTKEY_ADD_ACTION")}</a>
                    </SettingsChild>
                </SettingsOption>
            )
        })
    }

    getHotkeyStatusIcon = hotkey => {
        if (hotkey?.active) {
            return (<div className="status icon active">&#xE73E;</div>)
        } else {
            return (<div className="status icon inactive"></div>)
        }
    }

    updateHotkey(hotkey, idx) {
        this.state.hotkeys[idx] = Object.assign({}, hotkey)
        window.sendSettings({ hotkeys: this.state.hotkeys.slice() })
        this.forceUpdate()
    }

    updateHotkeyAction(action, idx, actionIdx) {
        this.state.hotkeys[idx].actions[actionIdx] = Object.assign({}, action)
        window.sendSettings({ hotkeys: this.state.hotkeys.slice() })
        this.forceUpdate()
    }

    deleteHotkey(idx) {
        this.state.hotkeys.splice(idx, 1)
        window.sendSettings({ hotkeys: this.state.hotkeys.slice() })
        this.forceUpdate()
    }


    getInfoMonitors = () => {
        if (this.state.monitors == undefined || Object.keys(this.state.monitors).length == 0) {
            return (<div className="no-displays-message">{T.t("GENERIC_NO_COMPATIBLE_DISPLAYS")}<br /><br /></div>)
        } else {
            return Object.values(this.state.monitors).map((monitor, index) => {

                let brightness = monitor.brightness
                let brightnessMax = monitor.brightnessMax

                if (monitor.type == "ddcci" && !monitor.brightnessType) {
                    brightness = "???"
                    brightnessMax = "???"
                }

                return (
                    <div key={monitor.key} className="monitorItem">
                        <br />
                        <div className="sectionSubtitle"><div className="icon">&#xE7F4;</div><div>{monitor.name}</div></div>
                        <p>{T.t("SETTINGS_MONITORS_DETAILS_NAME")}: <b>{getMonitorName(monitor, this.state.names)}</b>
                            <br />{T.t("SETTINGS_MONITORS_DETAILS_INTERNAL_NAME")}: <b>{monitor.hwid[1]}</b>
                            <br />{T.t("SETTINGS_MONITORS_DETAILS_COMMUNICATION")}: {this.getDebugMonitorType((monitor.type === "ddcci" && monitor.highLevelSupported?.brightness ? "ddcci-hl" : monitor.type))}
                            <br />{T.t("SETTINGS_MONITORS_DETAILS_BRIGHTNESS")}: <b>{(monitor.type == "none" ? T.t("GENERIC_NOT_SUPPORTED") : brightness)}</b>
                            <br />{T.t("SETTINGS_MONITORS_DETAILS_MAX_BRIGHTNESS")}: <b>{(monitor.type !== "ddcci" ? T.t("GENERIC_NOT_SUPPORTED") : brightnessMax)}</b>
                            <br />{T.t("SETTINGS_MONITORS_DETAILS_BRIGHTNESS_NORMALIZATION")}: <b>{(monitor.type == "none" ? T.t("GENERIC_NOT_SUPPORTED") : monitor.min + " - " + monitor.max)}</b>
                            <br />{T.t("SETTINGS_MONITORS_DETAILS_HDR")}: <b>{(monitor.hdr == "active" ? T.t("GENERIC_ACTIVE") : monitor.hdr == "supported" ? T.t("GENERIC_SUPPORTED") : T.t("GENERIC_UNSUPPORTED"))}</b>
                        </p>
                    </div>
                )
            })
        }
    }


    getDebugMonitors = () => {
        if (this.state.monitors == undefined || Object.keys(this.state.monitors).length == 0) {
            return (<div className="no-displays-message">{T.t("GENERIC_NO_COMPATIBLE_DISPLAYS")}<br /><br /></div>)
        } else {
            return Object.values(this.state.monitors).map((monitor, index) => {

                return (
                    <MonitorInfo key={monitor.key} name={getMonitorName(monitor, this.state.names)} monitor={monitor} debug={true} />
                )

            })
        }
    }

    getFeaturesMonitors = () => {
        try {
            const onChange = () => {
                window.sendSettings({ monitorFeaturesSettings: JSON.parse(JSON.stringify(window.settings.monitorFeaturesSettings)) })
            }
            if (this.state.monitors == undefined || Object.keys(this.state.monitors).length == 0) {
                return (<div className="no-displays-message">{T.t("GENERIC_NO_COMPATIBLE_DISPLAYS")}<br /><br /></div>)
            } else {
                return Object.values(this.state.monitors).map((monitor, index) => {
                    const features = this.state?.rawSettings.monitorFeatures[monitor.hwid[1]]
                    return (
                        <MonitorFeatures key={monitor.key} name={getMonitorName(monitor, this.state.names)} monitor={monitor} monitorFeatures={features} toggleFeature={this.toggleFeature} T={T} onChange={onChange} onAddFeature={() => {
                            this.setState({
                                showAddFeatureOverlay: true,
                                addFeatureMonitor: monitor.hwid[1],
                                addFeatureValue: "",
                                addFeatureError: false
                            }, () => {
                                this.addFeatureInputRef.current.focus()
                            })
                        }} />
                    )

                })
            }
        } catch (e) {

        }
    }

    getHDRMonitors = () => {
        try {
            if (this.state.monitors == undefined || Object.keys(this.state.monitors).length == 0) {
                return (<SettingsChild title={T.t("GENERIC_NO_COMPATIBLE_DISPLAYS")} />)
            } else {
                return Object.values(this.state.monitors).map((monitor, index) => {

                    return (
                        <SettingsChild key={monitor.key} icon="E7F4" title={getMonitorName(monitor, this.state.names)} input={
                            <div className="inputToggle-generic">
                                <input onChange={(e) => { this.setHDRMonitor(e.target.checked, monitor) }} checked={(this.state.rawSettings?.hdrDisplays?.[monitor.key] ? true : false)} data-checked={(this.state.rawSettings?.hdrDisplays?.[monitor.key] ? true : false)} type="checkbox" />
                            </div>
                        } />
                    )

                })
            }
        } catch (e) {
            console.log(e)
        }
    }

    getSDRMonitorsSettings = () => {
                try {
            if (this.state.monitors == undefined || Object.keys(this.state.monitors).length == 0) {
                return (<SettingsChild title={T.t("GENERIC_NO_COMPATIBLE_DISPLAYS")} />)
            } else {
                return Object.values(this.state.monitors).map((monitor, index) => {

                    return (
                        <SettingsChild key={monitor.key} icon="E7F4" title={getMonitorName(monitor, this.state.names)} input={
                            <div className="inputToggle-generic">
                                <input onChange={(e) => { this.setSDRMonitor(e.target.checked, monitor) }} checked={(this.state.rawSettings?.sdrAsMainSliderDisplays?.[monitor.key] ? true : false)} data-checked={(this.state.rawSettings?.sdrAsMainSliderDisplays?.[monitor.key] ? true : false)} type="checkbox" />
                            </div>
                        } />
                    )

                })
            }
        } catch (e) {
            console.log(e)
        }
    }

    setHDRMonitor = (value, monitor) => {
        const hdrDisplays = Object.assign({}, this.state.rawSettings?.hdrDisplays)
        hdrDisplays[monitor.key] = value
        this.setSetting("hdrDisplays", hdrDisplays)
    }

    setSDRMonitor = (value, monitor) => {
        const sdrDisplays = Object.assign({}, this.state.rawSettings?.sdrAsMainSliderDisplays)
        sdrDisplays[monitor.key] = value
        this.setSetting("sdrAsMainSliderDisplays", sdrDisplays)
    }

    getHideMonitors = () => {
        try {
            if (this.state.monitors == undefined || Object.keys(this.state.monitors).length == 0) {
                return (<SettingsChild title={T.t("GENERIC_NO_COMPATIBLE_DISPLAYS")} />)
            } else {
                return Object.values(this.state.monitors).map((monitor, index) => {

                    return (
                        <SettingsChild key={monitor.key} icon="E7F4" title={getMonitorName(monitor, this.state.names)} input={
                            <div className="inputToggle-generic">
                                <input onChange={(e) => { this.setHideMonitor(e.target.checked, monitor) }} checked={(this.state.rawSettings?.hideDisplays?.[monitor.key] ? true : false)} data-checked={(this.state.rawSettings?.hideDisplays?.[monitor.key] ? true : false)} type="checkbox" />
                            </div>
                        } />
                    )

                })
            }
        } catch (e) {
            console.log(e)
        }
    }

    setHideMonitor = (value, monitor) => {
        const hideDisplays = Object.assign({}, this.state.rawSettings?.hideDisplays)
        hideDisplays[monitor.key] = value
        this.setSetting("hideDisplays", hideDisplays)
    }

    toggleFeature = (monitor, featureRaw) => {
        const feature = `0x${parseInt(featureRaw).toString(16).toUpperCase()}`

        if (feature === "0x10" || feature === "0x13") return false; // Skip brightness
        if (feature === "0x" || feature === "0xNaN") return false; // Skip invalid

        const newFeatures = Object.assign({}, this.state.rawSettings.monitorFeatures)
        if (!newFeatures[monitor]) newFeatures[monitor] = {};
        newFeatures[monitor][feature] = (newFeatures[monitor][feature] ? false : true);

        window.sendSettings({ monitorFeatures: newFeatures })
    }

    getDebugMonitorType = (type) => {
        if (type == "none") {
            return (<><b>None</b> <span className="icon red vfix">&#xEB90;</span></>)
        } else if (type == "ddcci") {
            return (<><b>DDC/CI</b> <span className="icon green vfix">&#xE73D;</span></>)
        } else if (type == "ddcci-hl") {
            return (<><b>DDC/CI (HL)</b> <span className="icon green vfix">&#xE73D;</span></>)
        } else if (type == "wmi") {
            return (<><b>WMI</b> <span className="icon green vfix">&#xE73D;</span></>)
        } else if (type == "studio-display") {
            return (<><b>Studio Display</b> <span className="icon green vfix">&#xE73D;</span></>)
        } else {
            return (<><b>Unknown ({type})</b> <span className="icon red vfix">&#xEB90;</span></>)
        }
    }

    getSkipRestoreMonitors = () => {
        try {
            if (this.state.monitors == undefined || Object.keys(this.state.monitors).length == 0) {
                return (<SettingsChild title={T.t("GENERIC_NO_COMPATIBLE_DISPLAYS")} />)
            } else {
                return Object.values(this.state.monitors).map((monitor, index) => {

                    return (
                        <SettingsChild key={monitor.key} icon="E7F4" title={getMonitorName(monitor, this.state.names)} input={
                            <div className="inputToggle-generic">
                                <input onChange={(e) => { this.setSkipRestoreMonitor(e.target.checked, monitor) }} checked={(this.state.rawSettings?.userSkipReapply?.indexOf(monitor.hwid[1]) >= 0 ? true : false)} data-checked={(this.state.rawSettings?.userSkipReapply?.indexOf(monitor.hwid[1]) >= 0 ? true : false)} type="checkbox" />
                            </div>
                        } />
                    )

                })
            }
        } catch (e) {
            console.log(e)
        }
    }

    setSkipRestoreMonitor = (value, monitor) => {
        const userSkipReapply = this.state.rawSettings?.userSkipReapply
        const index = this.state.rawSettings?.userSkipReapply?.indexOf(monitor.hwid[1])
        if(index >= 0 && !value) {
            userSkipReapply.splice(index, 1)
        } else if(index === -1 && value) {
            userSkipReapply.push(monitor.hwid[1])
        }
        this.setSetting("userSkipReapply", userSkipReapply)
    }






    // Update monitor info
    recievedMonitors = (e) => {
        let newMonitors = Object.assign(e.detail, {})
        this.lastLevels = []
        let numMonitors = 0
        for (let key in newMonitors) {
            if (newMonitors[key].type != "none") numMonitors++;
        }
        this.numMonitors = numMonitors
        this.setState({
            monitors: newMonitors
        })
    }

    // Update settings
    recievedSettings = (e) => {
        const settings = e.detail
        const openAtLogin = settings.openAtLogin
        const brightnessAtStartup = settings.brightnessAtStartup
        const linkedLevelsActive = (settings.linkedLevelsActive || false)
        const updateInterval = (settings.updateInterval || 500) * 1
        const remaps = (settings.remaps || {})
        const names = (settings.names || {})
        const adjustmentTimes = (settings.adjustmentTimes || {})
        const killWhenIdle = (settings.killWhenIdle || false)
        const order = (settings.order || [])
        const checkTimeAtStartup = (settings.checkTimeAtStartup || false)
        const checkForUpdates = (settings.checkForUpdates || false)
        const adjustmentTimeIndividualDisplays = (settings.adjustmentTimeIndividualDisplays || false)
        const language = (settings.language || "system")
        const hotkeys = (settings.hotkeys || [])
        const hotkeyPercent = (settings.hotkeyPercent || 10)
        const analytics = settings.analytics
        const useAcrylic = settings.useAcrylic
        const scrollShortcut = settings.scrollShortcut
        this.setState({
            rawSettings: (Object.keys(settings).length > 0 ? settings : this.state.rawSettings),
            openAtLogin,
            brightnessAtStartup,
            linkedLevelsActive,
            remaps,
            updateInterval,
            names,
            adjustmentTimes,
            killWhenIdle,
            order,
            checkTimeAtStartup,
            checkForUpdates,
            adjustmentTimeIndividualDisplays,
            language,
            hotkeys,
            hotkeyPercent,
            analytics,
            useAcrylic,
            scrollShortcut
        }, () => {
            this.forceUpdate()
        })
    }


    isSection = (name) => {
        if (this.state.activePage == name) {
            return true
        } else {
            return false
        }
    }

    isIcon = (icon) => (this.state.rawSettings.icon === icon ? true : false)

    addAdjustmentTime = () => {
        this.state.adjustmentTimes.push({
            brightness: 50,
            time: "12:30",
            monitors: {},
            useSunCalc: false,
            sunCalc: "sunrise"
        })
        this.forceUpdate()
        this.adjustmentTimesUpdated()
    }

    adjustmentTimesUpdated = () => {
        this.setState({ adjustmentTimes: this.state.adjustmentTimes.slice(0) })
        this.sendSettingsThrottle({ adjustmentTimes: this.state.adjustmentTimes.slice(0) })
        //window.sendSettings({ adjustmentTimes: this.state.adjustmentTimes })
    }

    setSetting = (setting, sentVal) => {
        let value = sentVal;
        if (sentVal === "on") value = true;
        if (sentVal === "off") value = false;

        const newState = {}
        newState[setting] = value
        this.setState({...newState, ...{rawSettings: {...this.state.rawSettings, ...{[setting]: value} } } })
        window.sendSettings(newState)
    }

    renderToggle = (setting, showText = true, textSide = "right", inverse = false) => {
        const isActive = (this.state.rawSettings?.[setting] ? true : false)
        const isVisiblyActive = (inverse ? !isActive : isActive)
        return (<div className="inputToggle-generic" data-textside={textSide}>
            <input onChange={(e) => { this.setSetting(setting, e.target.checked) }} checked={isActive} data-checked={isVisiblyActive} type="checkbox" />
            <div className="text">{(isVisiblyActive ? T.t("GENERIC_ON") : T.t("GENERIC_OFF"))}</div>
        </div>)
    }

    render() {
        return (
            <SafeRender>
                <div className="window-base" data-theme={window.settings.theme || "default"}>
                    <Titlebar title={T.t("SETTINGS_TITLE")} />
                    <div className="window-base-inner">
                        <div id="sidebar">
                            {this.getSidebar()}
                        </div>
                        <div id="page" ref={this.settingsPageRef}>

                            <SettingsPage current={this.state.activePage} id="general">
                                <div className="pageSection">

                                    <div className="sectionTitle">{T.t("SETTINGS_GENERAL_TITLE")}</div>
                                    
                                    <SettingsOption title={T.t("SETTINGS_GENERAL_STARTUP")} input={this.renderToggle("openAtLogin")} />

                                    <SettingsOption title={T.t("SETTINGS_GENERAL_BRIGHTNESS_STARTUP_TITLE")} description={T.t("SETTINGS_GENERAL_BRIGHTNESS_STARTUP_DESC")} input={this.renderToggle("brightnessAtStartup")} />

                                    <SettingsOption title={T.t("SETTINGS_GENERAL_DISABLE_ON_LOCK_SCREEN_TITLE")} description={T.t("SETTINGS_GENERAL_DISABLE_ON_LOCK_SCREEN_DESC")} input={this.renderToggle("disableOnLockScreen")} />

                                    <SettingsOption title={T.t("SETTINGS_GENERAL_LANGUAGE_TITLE")} input={(
                                        <select value={window.settings.language} onChange={(e) => {
                                            this.setState({ language: e.target.value })
                                            window.sendSettings({ language: e.target.value })
                                        }}>
                                            <option value="system">{T.t("SETTINGS_GENERAL_LANGUAGE_SYSTEM")}</option>
                                            {this.getLanguages()}
                                        </select>
                                    )} />

                                    <SettingsOption title={T.t("SETTINGS_GENERAL_THEME_TITLE")} input={(
                                        <select value={window.settings.theme} onChange={this.themeChanged}>
                                            <option value="default">{T.t("SETTINGS_GENERAL_THEME_SYSTEM")}</option>
                                            <option value="dark">{T.t("SETTINGS_GENERAL_THEME_DARK")}</option>
                                            <option value="light">{T.t("SETTINGS_GENERAL_THEME_LIGHT")}</option>
                                        </select>
                                    )} />

                                    <SettingsOption title={T.t("SETTINGS_GENERAL_WINDOWS_UI_STYLE_TITLE")} input={(
                                        <select value={window.settings.windowsStyle} onChange={(e) => this.setSetting("windowsStyle", e.target.value)}>
                                            <option value="system">{T.t("SETTINGS_GENERAL_THEME_SYSTEM")}</option>
                                            <option value="win10">Windows 10</option>
                                            <option value="win11">Windows 11</option>
                                        </select>
                                    )} />

                                    <div className="win10only">
                                        <SettingsOption title={T.t("SETTINGS_GENERAL_ACRYLIC_TITLE")} description={T.t("SETTINGS_GENERAL_ACRYLIC_DESC")} input={this.renderToggle("useAcrylic")} />
                                    </div>

                                    <div className="win11only">
                                        <SettingsOption title={T.t("SETTINGS_GENERAL_MICA_TITLE")} description={T.t("SETTINGS_GENERAL_MICA_DESC")} input={this.renderToggle("useAcrylic")} />
                                    </div>

                                    <SettingsOption title={T.t("SETTINGS_GENERAL_TRAY_ICON_TITLE")} input={(
                                        <div className="icons-row">
                                            <div className="icon-option" data-active={this.isIcon("icon")} onClick={() => window.sendSettings({ icon: "icon" })}>
                                                <img src={DefaultIcon} />
                                            </div>
                                            <div className="icon-option" data-active={this.isIcon("mdl2")} onClick={() => window.sendSettings({ icon: "mdl2" })}>
                                                <img src={MDL2Icon} />
                                            </div>
                                            <div className="icon-option" data-active={this.isIcon("fluent")} onClick={() => window.sendSettings({ icon: "fluent" })}>
                                                <img src={FluentIcon} />
                                            </div>
                                        </div>
                                    )} />

                                    <SettingsOption title={T.t("SETTINGS_GENERAL_ANALYTICS_TITLE")} description={T.h("SETTINGS_GENERAL_ANALYTICS_DESC", '<a href="javascript:window.openURL(\'privacy-policy\')">' + T.t("SETTINGS_GENERAL_ANALYTICS_LINK") + '</a>')} input={this.renderToggle("analytics")} />

                                </div>

                                <div className="pageSection">
                                    <div className="sectionTitle">{T.t("SETTINGS_GENERAL_TROUBLESHOOTING")}</div>

                                    <SettingsOption title={T.t("SETTINGS_GENERAL_DIS_MONITOR_FEATURES_TITLE")} description={T.h("SETTINGS_GENERAL_DIS_MONITOR_FEATURES_DESC", '<a href="javascript:window.openURL(\'troubleshooting-features\')">' + T.t("SETTINGS_GENERAL_ANALYTICS_LINK") + '</a>')} expandable={true}>
                                        <SettingsChild title={"Apple Studio Displays"} input={this.renderToggle("disableAppleStudio", true, "right", true)} />
                                        <SettingsChild title={"DDC/CI HL"} input={this.renderToggle("disableHighLevel", true, "right", true)} />
                                        <SettingsChild title={"HDR"} input={this.renderToggle("disableHDR", true, "right", true)} />
                                        <SettingsChild title={"WMIC"} input={this.renderToggle("disableWMIC", true, "right", true)} />
Download .txt
gitextract_15q36qbk/

├── .babelrc
├── .gitattributes
├── .github/
│   ├── FUNDING.yml
│   └── workflows/
│       └── ci.yml
├── .gitignore
├── .sassrc
├── .vscode/
│   └── settings.json
├── LICENSE
├── README.md
├── package.json
├── resources/
│   ├── appx/
│   │   └── extensions.xml
│   └── nsis/
│       └── installer.nsh
└── src/
    ├── Monitors.js
    ├── Translate.js
    ├── TranslateReact.js
    ├── Utils.js
    ├── components/
    │   ├── BrightnessPanel.jsx
    │   ├── DDCCISliders.jsx
    │   ├── HDRSliders.jsx
    │   ├── IntroWindow.jsx
    │   ├── MonitorFeatures.jsx
    │   ├── MonitorInfo.jsx
    │   ├── SafeRender.jsx
    │   ├── SettingsOption.jsx
    │   ├── SettingsWindow.jsx
    │   ├── Slider.jsx
    │   └── Titlebar.jsx
    ├── css/
    │   ├── common.scss
    │   ├── intro.scss
    │   ├── mica.scss
    │   ├── page.scss
    │   ├── panel.scss
    │   ├── settings-option.scss
    │   ├── slider.scss
    │   └── vars.scss
    ├── electron.js
    ├── hooks/
    │   └── useObject.js
    ├── html/
    │   ├── index.html
    │   ├── intro.html
    │   └── settings.html
    ├── intro-preload.js
    ├── intro.js
    ├── localization/
    │   ├── ar.json
    │   ├── az.json
    │   ├── bn.json
    │   ├── ckb.json
    │   ├── cs.json
    │   ├── de.json
    │   ├── el.json
    │   ├── en-GB.json
    │   ├── en.json
    │   ├── es.json
    │   ├── fa.json
    │   ├── fi.json
    │   ├── fr.json
    │   ├── he.json
    │   ├── hi.json
    │   ├── hr.json
    │   ├── hu.json
    │   ├── id.json
    │   ├── it.json
    │   ├── ja.json
    │   ├── ko.json
    │   ├── lt.json
    │   ├── nb.json
    │   ├── nl.json
    │   ├── pl.json
    │   ├── pt-BR.json
    │   ├── pt.json
    │   ├── ro.json
    │   ├── ru.json
    │   ├── sk.json
    │   ├── sv.json
    │   ├── ta.json
    │   ├── th.json
    │   ├── tr.json
    │   ├── uk.json
    │   ├── vi.json
    │   ├── zh-Hant.json
    │   └── zh_Hans.json
    ├── modules/
    │   ├── acrylic/
    │   │   ├── .gitignore
    │   │   ├── acrylic.cc
    │   │   ├── binding.gyp
    │   │   ├── index.js
    │   │   └── package.json
    │   ├── node-active-window/
    │   │   ├── .eslintrc.json
    │   │   ├── .gitignore
    │   │   ├── .prettierrc.json
    │   │   ├── CHANGELOG.md
    │   │   ├── LICENSE
    │   │   ├── README.md
    │   │   ├── binding.gyp
    │   │   ├── dist/
    │   │   │   ├── index.d.ts
    │   │   │   ├── index.js
    │   │   │   ├── types.d.ts
    │   │   │   └── types.js
    │   │   ├── module/
    │   │   │   └── windows/
    │   │   │       ├── demo/
    │   │   │       │   ├── Makefile
    │   │   │       │   └── main.cpp
    │   │   │       ├── napi/
    │   │   │       │   ├── main.cpp
    │   │   │       │   ├── module.cpp
    │   │   │       │   └── module.h
    │   │   │       └── src/
    │   │   │           ├── ActiveWindow.cpp
    │   │   │           └── ActiveWindow.h
    │   │   ├── package.json
    │   │   ├── src/
    │   │   │   ├── index.ts
    │   │   │   └── types.ts
    │   │   ├── tsconfig.build.json
    │   │   └── tsconfig.json
    │   ├── node-ddcci/
    │   │   ├── .clang-format
    │   │   ├── .gitignore
    │   │   ├── README.md
    │   │   ├── binding.gyp
    │   │   ├── ddcci.cc
    │   │   ├── index.d.ts
    │   │   ├── index.js
    │   │   ├── package.json
    │   │   └── vcp.js
    │   ├── tt-windows-utils/
    │   │   ├── .gitignore
    │   │   ├── binding.gyp
    │   │   ├── index.js
    │   │   ├── package.json
    │   │   ├── windows_app_startup.cc
    │   │   ├── windows_media_status.cc
    │   │   ├── windows_power_events.cc
    │   │   ├── windows_window_material.cc
    │   │   └── windows_window_utils.cc
    │   ├── win32-displayconfig/
    │   │   ├── .gitignore
    │   │   ├── CONTRIBUTORS
    │   │   ├── COPYRIGHT
    │   │   ├── README.md
    │   │   ├── binding.gyp
    │   │   ├── index.d.ts
    │   │   ├── index.js
    │   │   ├── package.json
    │   │   ├── scripts/
    │   │   │   ├── dumpextract.js
    │   │   │   ├── dumpquery.js
    │   │   │   └── watchmouse.js
    │   │   └── win32-displayconfig.cc
    │   ├── windows-hdr/
    │   │   ├── .gitignore
    │   │   ├── binding.gyp
    │   │   ├── index.js
    │   │   ├── package.json
    │   │   └── windows-hdr.cc
    │   └── wmi-bridge/
    │       ├── binding.gyp
    │       ├── example.js
    │       ├── index.js
    │       ├── package.json
    │       └── wmi-bridge.cc
    ├── monitor-rules.json
    ├── panel-preload.js
    ├── panel.js
    ├── parcel.js
    ├── parcelAPI.js
    ├── settings-preload.js
    ├── settings.js
    ├── utils/
    │   └── BrightnessPanel/
    │       └── getMonitorName.js
    ├── vcp-codes.js
    └── wmi-bridge-test.js
Download .txt
SYMBOL INDEX (465 symbols across 45 files)

FILE: src/Monitors.js
  function deepCopy (line 17) | function deepCopy(obj) {
  function determineDDCCIMethod (line 449) | function determineDDCCIMethod() {
  function setSDRBrightness (line 915) | function setSDRBrightness(brightness, id) {
  function setBrightness (line 926) | function setBrightness(brightness, id) {
  function checkVCPIfEnabled (line 967) | async function checkVCPIfEnabled(monitor, code, setting, skipCache = fal...
  function checkIfVCPSupported (line 996) | async function checkIfVCPSupported(monitor, code) {
  function checkVCP (line 1016) | async function checkVCP(monitor, code, skipCacheWrite = false) {
  function setVCP (line 1045) | async function setVCP(monitor, code, value) {
  function getHighLevelBrightness (line 1064) | async function getHighLevelBrightness(monitor) {
  function setHighLevelBrightness (line 1074) | async function setHighLevelBrightness(monitor, value) {
  function normalizeBrightness (line 1085) | function normalizeBrightness(brightness, unnormalize = false, min = 0, m...
  function applyRemap (line 1113) | function applyRemap(monitor) {
  function readInstanceName (line 1131) | function readInstanceName(insName) {
  function parseWMIString (line 1135) | function parseWMIString(str) {
  function getDDCCI (line 1147) | function getDDCCI() {
  function getWMIC (line 1162) | function getWMIC() {
  function wait (line 1288) | function wait(ms = 2000) {
  function vcpStr (line 1296) | function vcpStr(code) {

FILE: src/Translate.js
  class Translate (line 1) | class Translate {
    method constructor (line 2) | constructor(localizationData = {}, fallbackData = {}) {
    method setLocalizationData (line 11) | setLocalizationData(data = {}, fallback = {}) {
    method makeTranslation (line 16) | makeTranslation(string, args = []) {
    method getString (line 24) | getString(key, ...args) {
    method getHTML (line 33) | getHTML(key, ...args) {

FILE: src/TranslateReact.js
  class TranslateReact (line 4) | class TranslateReact extends Translate {
    method getHTML (line 6) | getHTML(key, ...args) {

FILE: src/Utils.js
  function udpSendCommand (line 4) | function udpSendCommand(type, data, port = 14715, key) {
  function pipeSendCommand (line 24) | function pipeSendCommand(type, data, port = 14715, key) {
  method wait (line 56) | wait(ms = 2000) {
  method handleProcessedArgs (line 133) | async handleProcessedArgs(args = {}, knownDisplaysPath, settingsPath) {
  function upgradeAdjustmentTimes (line 236) | function upgradeAdjustmentTimes(times = []) {
  function getVersionValue (line 263) | function getVersionValue(version = 'v1.0.0') {
  function lerp (line 269) | function lerp(start, finish, perc) {
  function parseTime (line 273) | function parseTime(time) {
  function getKnownDisplays (line 278) | function getKnownDisplays(knownDisplaysPath) {
  function getCalibratedValue (line 302) | function getCalibratedValue(value, calibrationPoints = [], reverse = fal...

FILE: src/components/DDCCISliders.jsx
  function DDCCISliders (line 5) | function DDCCISliders(props) {
  function setVCP (line 117) | function setVCP(monitor, code, value) {

FILE: src/components/HDRSliders.jsx
  function HDRSliders (line 5) | function HDRSliders(props) {
  function setSDRBrightness (line 26) | function setSDRBrightness(monitor, value) {

FILE: src/components/IntroWindow.jsx
  class IntroWindow (line 8) | class IntroWindow extends PureComponent {
    method constructor (line 10) | constructor(props) {
    method componentDidMount (line 14) | componentDidMount() {
    method render (line 19) | render() {

FILE: src/components/MonitorFeatures.jsx
  function MonitorFeatures (line 10) | function MonitorFeatures(props) {
  function MonitorFeaturesSettings (line 198) | function MonitorFeaturesSettings(props) {
  function BrightnessFeatureSettings (line 297) | function BrightnessFeatureSettings(props) {
  function WindowsIconsOptions (line 399) | function WindowsIconsOptions(props) {
  function findVCPCodeName (line 405) | function findVCPCodeName(code) {

FILE: src/components/MonitorInfo.jsx
  function MonitorInfo (line 5) | function MonitorInfo(props) {
  function setVCP (line 112) | function setVCP(monitor, code, value) {
  function setSDRBrightness (line 122) | function setSDRBrightness(monitor, value) {
  function getDebugMonitorType (line 131) | function getDebugMonitorType(type) {

FILE: src/components/SafeRender.jsx
  class SafeRender (line 3) | class SafeRender extends React.Component {
    method constructor (line 4) | constructor(props) {
    method getDerivedStateFromError (line 9) | static getDerivedStateFromError(error) {
    method componentDidCatch (line 13) | componentDidCatch(error, errorInfo) {
    method render (line 22) | render() {

FILE: src/components/SettingsOption.jsx
  function SettingsOption (line 4) | function SettingsOption(props) {
  function SettingsChild (line 37) | function SettingsChild(props) {

FILE: src/components/SettingsWindow.jsx
  function vcpStr (line 26) | function vcpStr(code) {
  class SettingsWindow (line 113) | class SettingsWindow extends PureComponent {
    method constructor (line 115) | constructor(props) {
    method componentDidMount (line 172) | componentDidMount() {
    method onDragEnd (line 209) | onDragEnd(result) {
    method updateAdjustmentTime (line 610) | updateAdjustmentTime(time, idx) {
    method updateHotkey (line 786) | updateHotkey(hotkey, idx) {
    method updateHotkeyAction (line 792) | updateHotkeyAction(action, idx, actionIdx) {
    method deleteHotkey (line 798) | deleteHotkey(idx) {
    method render (line 1142) | render() {
  function addNewProfile (line 1640) | function addNewProfile(state) {
  function getProfileMonitors (line 1656) | function getProfileMonitors(monitors, profile, onChange) {
  function getMonitorName (line 1670) | function getMonitorName(monitor, renames) {
  function AppProfile (line 1678) | function AppProfile(props) {
  function SettingsPage (line 1725) | function SettingsPage(props) {
  function ActionItem (line 1734) | function ActionItem(props) {

FILE: src/components/Slider.jsx
  class Slider (line 5) | class Slider extends Component {
    method constructor (line 57) | constructor(props) {
    method componentDidUpdate (line 65) | componentDidUpdate(oldProps) {
    method render (line 73) | render() {

FILE: src/components/Titlebar.jsx
  class Titlebar (line 3) | class Titlebar extends React.Component {
    method constructor (line 5) | constructor(props) {
    method render (line 12) | render() {

FILE: src/electron.js
  function reopenAppWithConsole (line 36) | function reopenAppWithConsole() {
  function vcpStr (line 131) | function vcpStr(code) {
  function startMonitorThread (line 175) | function startMonitorThread() {
  function stopMonitorThread (line 232) | function stopMonitorThread() {
  function getVCP (line 242) | function getVCP(monitor, code) {
  function doWMIBridgeTest (line 275) | async function doWMIBridgeTest() {
  function enableMouseEvents (line 313) | function enableMouseEvents() {
  function pauseMouseEvents (line 374) | function pauseMouseEvents(paused) {
  function willPauseMouseEvents (line 393) | function willPauseMouseEvents(time = 10000) {
  function pingAnalytics (line 409) | function pingAnalytics() {
  function readSettings (line 563) | function readSettings(doProcessSettings = true) {
  function writeSettings (line 745) | function writeSettings(newSettings = {}, processAfter = true, sendUpdate...
  function processSettings (line 764) | function processSettings(newSettings = {}, sendUpdate = true) {
  function blockBadDisplays (line 958) | function blockBadDisplays(tag = "") {
  function shouldSkipDisplay (line 981) | function shouldSkipDisplay(monitorOrHwid1, skipEventCheck = false) {
  function updateKnownDisplays (line 997) | async function updateKnownDisplays(force = false, immediate = false) {
  function getKnownDisplays (line 1031) | function getKnownDisplays(useCurrentMonitors) {
  function setKnownBrightness (line 1055) | function setKnownBrightness(useCurrentMonitors = false, useTransition = ...
  function applyProfile (line 1063) | function applyProfile(profile = {}, useTransition = false, transitionSpe...
  function applyHotkeys (line 1102) | function applyHotkeys(monitorList = monitors) {
  function doHotkey (line 1130) | async function doHotkey(hotkey) {
  function hotkeyOverlayStart (line 1303) | function hotkeyOverlayStart(timeout = 3000, force = true) {
  function hotkeyOverlayShow (line 1315) | async function hotkeyOverlayShow() {
  function hotkeyOverlayHide (line 1386) | function hotkeyOverlayHide(force = true) {
  function applyOrder (line 1417) | function applyOrder(monitorList = monitors) {
  function applyRemaps (line 1428) | function applyRemaps(monitorList = monitors) {
  function applyRemap (line 1435) | function applyRemap(monitor) {
  function minMax (line 1451) | function minMax(value, min = 0, max = 100) {
  function determineTheme (line 1458) | function determineTheme(themeName) {
  function enableStartup (line 1468) | function enableStartup(appName, appPath) {
  function disableStartup (line 1473) | function disableStartup(appName) {
  function updateStartupOption (line 1482) | async function updateStartupOption(openAtLogin) {
  function getLocalization (line 1530) | function getLocalization() {
  function getAllLanguages (line 1581) | async function getAllLanguages() {
  function getSettings (line 1615) | function getSettings() {
  function getDDCBrightnessVCPs (line 1620) | function getDDCBrightnessVCPs() {
  function sendToAllWindows (line 1634) | function sendToAllWindows(eventName, data) {
  function getThemeRegistry (line 1670) | async function getThemeRegistry() {
  function getTrayIconPath (line 1726) | function getTrayIconPath() {
  function getAccentColors (line 1735) | function getAccentColors() {
  function tryVibrancy (line 1769) | function tryVibrancy(window, value = null) {
  function listen (line 1819) | function listen(resolve) {
  function refreshMonitors (line 1834) | async function refreshMonitors(fullRefresh = false, bypassRateLimit = fa...
  function pauseMonitorUpdates (line 1940) | function pauseMonitorUpdates() {
  function updateBrightnessThrottle (line 1958) | function updateBrightnessThrottle(id, level, useCap = true, sendUpdate =...
  function updateBrightness (line 1997) | function updateBrightness(index, newLevel, useCap = true, vcpValue = "br...
  function updateAllBrightness (line 2150) | function updateAllBrightness(brightness, mode = "offset") {
  function normalizeBrightness (line 2191) | function normalizeBrightness(brightness, normalize = false, min = 0, max...
  function transitionBrightness (line 2223) | function transitionBrightness(level, eventMonitors = [], stepSpeed = 1) {
  function transitionlessBrightness (line 2278) | function transitionlessBrightness(level, eventMonitors = []) {
  function setRecentlyInteracted (line 2293) | function setRecentlyInteracted(hasInteracted) {
  function sleepDisplays (line 2306) | function sleepDisplays(mode = "ps", delayMS = 333) {
  function turnOffDisplayDDC (line 2329) | async function turnOffDisplayDDC(hwid, toggle = false) {
  function readInstanceName (line 2368) | function readInstanceName(insName) {
  function createPanel (line 2522) | function createPanel(toggleOnLoad = false, isRefreshing = false, showOnL...
  function currentOverlayType (line 2714) | function currentOverlayType() {
  function setAlwaysOnTop (line 2723) | function setAlwaysOnTop(onTop = true) {
  function destroyPanel (line 2740) | function destroyPanel() {
  function restartPanel (line 2748) | function restartPanel(show = false) {
  function getPrimaryDisplay (line 2766) | function getPrimaryDisplay() {
  function repositionPanel (line 2796) | function repositionPanel() {
  function startFocusTracking (line 2915) | function startFocusTracking() {
  function stopFocusTracking (line 2970) | function stopFocusTracking() {
  function windowMatchesProfile (line 2978) | function windowMatchesProfile(window) {
  function applyProfileBrightness (line 2996) | function applyProfileBrightness(profile) {
  function getMainWindowHandle (line 3007) | function getMainWindowHandle() {
  function showPanel (line 3046) | function showPanel(show = true, height = 300) {
  function trySetForegroundWindow (line 3115) | function trySetForegroundWindow(hwnd) {
  function startHidePanel (line 3126) | function startHidePanel() {
  function startPanelAnimation (line 3140) | async function startPanelAnimation() {
  function hrtimeDeltaForFrequency (line 3166) | function hrtimeDeltaForFrequency(freq) {
  function doAnimationStep (line 3170) | function doAnimationStep() {
  function createTray (line 3311) | function createTray() {
  function recreateTray (line 3342) | async function recreateTray() {
  function setTrayMenu (line 3351) | function setTrayMenu() {
  function getPausableSeparatorMenuItem (line 3368) | function getPausableSeparatorMenuItem() {
  function getTimeAdjustmentsMenuItem (line 3375) | function getTimeAdjustmentsMenuItem() {
  function getDetectIdleMenuItem (line 3382) | function getDetectIdleMenuItem() {
  function getProfilesMenuItem (line 3389) | function getProfilesMenuItem() {
  function getDebugTrayMenuItems (line 3407) | function getDebugTrayMenuItems() {
  function setTrayPercent (line 3424) | function setTrayPercent() {
  function tryEagerUpdate (line 3446) | function tryEagerUpdate(forceRefresh = true) {
  function quitApp (line 3454) | function quitApp() {
  function showIntro (line 3521) | function showIntro() {
  function createSettings (line 3589) | function createSettings() {
  function sendSettingsBounds (line 3675) | function sendSettingsBounds() {
  function runUpdate (line 3822) | function runUpdate(expectedSize = false) {
  function addEventListeners (line 3902) | function addEventListeners() {
  function handleAccentChange (line 3919) | function handleAccentChange() {
  function handleMonitorChange (line 3940) | function handleMonitorChange(t, e, d) {
  function handleMetricsChange (line 4022) | function handleMetricsChange(type) {
  function restartBackgroundUpdate (line 4090) | function restartBackgroundUpdate() {
  function getIdleSettingValue (line 4120) | function getIdleSettingValue() {
  function idleCheckLong (line 4125) | function idleCheckLong() {
  function startIdleCheckShort (line 4135) | async function startIdleCheckShort() {
  function isFocusedWindowFullscreen (line 4144) | function isFocusedWindowFullscreen() {
  function isMediaPlaying (line 4156) | function isMediaPlaying() {
  function idleCheckShort (line 4167) | function idleCheckShort() {
  function getCurrentAdjustmentEvent (line 4247) | function getCurrentAdjustmentEvent() {
  function getNextAdjustmentEvent (line 4276) | function getNextAdjustmentEvent() {
  function getCurrentAdjustmentEventLERP (line 4311) | function getCurrentAdjustmentEventLERP() {
  function getSunCalcTime (line 4354) | function getSunCalcTime(timeName = "solarNoon") {
  function getSunCalcTimes (line 4360) | function getSunCalcTimes() {
  function applyCurrentAdjustmentEvent (line 4370) | function applyCurrentAdjustmentEvent(force = false, instant = true) {
  function handleBackgroundUpdate (line 4424) | function handleBackgroundUpdate(force = false) {
  function getUserCoordinates (line 4448) | async function getUserCoordinates() {
  function getAndApplyUserCoordinates (line 4473) | async function getAndApplyUserCoordinates() {
  function handleCommandLine (line 4524) | function handleCommandLine(event, argv, directory, additionalData) {
  function checkMicaWallpaper (line 4671) | function checkMicaWallpaper() {
  function sendMicaWallpaper (line 4716) | async function sendMicaWallpaper() {

FILE: src/hooks/useObject.js
  function useObject (line 3) | function useObject(initialState = {}) {

FILE: src/intro-preload.js
  function detectSunValley (line 7) | function detectSunValley() {

FILE: src/modules/acrylic/acrylic.cc
  type AccentState (line 4) | enum AccentState {
  type WindowCompositionAttribute (line 14) | enum WindowCompositionAttribute {
  type AccentPolicy (line 18) | struct AccentPolicy {
  type WindowCompositionAttributeData (line 25) | struct WindowCompositionAttributeData {
  function setAcrylic (line 36) | void setAcrylic(const Napi::CallbackInfo &info) {
  function disableAcrylic (line 82) | void disableAcrylic(const Napi::CallbackInfo &info) {
  function Init (line 115) | Napi::Object Init(Napi::Env env, Napi::Object exports) {

FILE: src/modules/node-active-window/dist/index.js
  constant SUPPORTED_PLATFORMS (line 17) | const SUPPORTED_PLATFORMS = ['win32', 'linux', 'darwin'];

FILE: src/modules/node-active-window/dist/types.d.ts
  type NativeWindowInfo (line 1) | interface NativeWindowInfo {
  type WindowInfo (line 10) | interface WindowInfo {
  type Module (line 21) | interface Module<T> {
  type InitializeOptions (line 29) | interface InitializeOptions {
  type IActiveWindow (line 32) | interface IActiveWindow extends Omit<Module<WindowInfo>, 'runLoop'> {

FILE: src/modules/node-active-window/module/windows/demo/main.cpp
  function printWindowInfo (line 7) | void printWindowInfo(PaymoActiveWindow::WindowInfo* inf) {
  function pollWindowInfo (line 17) | void pollWindowInfo(PaymoActiveWindow::ActiveWindow* aw) {
  function getCpuTime (line 32) | double getCpuTime() {
  function BOOL (line 43) | BOOL WINAPI signalHandler(DWORD signal) {
  function main (line 52) | int main(int argc, char* argv[]) {

FILE: src/modules/node-active-window/module/windows/napi/main.cpp
  function InitAll (line 4) | Napi::Object InitAll(Napi::Env env, Napi::Object exports) {

FILE: src/modules/node-active-window/module/windows/napi/module.h
  function namespace (line 8) | namespace module {

FILE: src/modules/node-active-window/module/windows/src/ActiveWindow.cpp
  type PaymoActiveWindow (line 3) | namespace PaymoActiveWindow {
    function WindowInfo (line 24) | WindowInfo* ActiveWindow::getActiveWindow() {
    function watch_t (line 88) | watch_t ActiveWindow::watchActiveWindow(watch_callback cb) {
    type LANGCODEPAGE (line 150) | struct LANGCODEPAGE {
    function IAppxManifestProperties (line 247) | IAppxManifestProperties* ActiveWindow::getUWPPackageProperties(std::ws...
    function BOOL (line 322) | BOOL CALLBACK ActiveWindow::EnumChildWindowsCb(HWND hWindow, LPARAM pa...
    function VOID (line 346) | VOID CALLBACK ActiveWindow::WinEventProcCb(HWINEVENTHOOK hHook, DWORD ...

FILE: src/modules/node-active-window/module/windows/src/ActiveWindow.h
  function namespace (line 20) | namespace PaymoActiveWindow {

FILE: src/modules/node-active-window/src/index.ts
  constant SUPPORTED_PLATFORMS (line 9) | const SUPPORTED_PLATFORMS = ['win32', 'linux', 'darwin'];

FILE: src/modules/node-active-window/src/types.ts
  type NativeWindowInfo (line 1) | interface NativeWindowInfo {
  type WindowInfo (line 11) | interface WindowInfo {
  type Module (line 23) | interface Module<T> {
  type InitializeOptions (line 32) | interface InitializeOptions {
  type IActiveWindow (line 36) | interface IActiveWindow extends Omit<Module<WindowInfo>, 'runLoop'> {

FILE: src/modules/node-ddcci/ddcci.cc
  type Monitor (line 17) | struct Monitor {
  type MonitorHighLevel (line 23) | struct MonitorHighLevel {
  type PhysicalMonitor (line 37) | struct PhysicalMonitor {
  type DisplayDevice (line 50) | struct DisplayDevice {
  type DisplayMonitor (line 57) | struct DisplayMonitor {
  function p (line 69) | void
  function d (line 78) | void
  function clearMonitorData (line 86) | void
  function cleanMonitorHandles (line 106) | void
  function getLastErrorString (line 127) | std::string
  function getPhysicalMonitorName (line 150) | std::string
  function getAllDisplays (line 162) | std::map<std::string, DisplayDevice>
  function getAllHandles (line 212) | std::vector<struct Monitor>
  function MonitorHighLevel (line 260) | MonitorHighLevel
  function getCapabilitiesString (line 299) | std::string
  function getPhysicalHandleResults (line 370) | std::string
  function populateHandlesMapLegacy (line 420) | void
  function populateHandlesMapNormal (line 546) | void
  function populateHandlesMap (line 711) | void
  function refresh (line 727) | Napi::Value
  function clearDisplayCache (line 748) | void
  function getNAPICapabilitiesString (line 759) | Napi::String
  function getMonitorList (line 796) | Napi::Array
  function getAllMonitors (line 810) | Napi::Array
  function setVCP (line 842) | Napi::Value
  function getVCP (line 873) | Napi::Value
  function saveCurrentSettings (line 909) | Napi::Boolean
  function getHighLevelBrightness (line 935) | Napi::Value
  function setHighLevelBrightness (line 972) | Napi::Value
  function getHighLevelContrast (line 1002) | Napi::Value
  function setHighLevelContrast (line 1039) | Napi::Value
  function setLogLevel (line 1069) | void
  function getMonitorInputs (line 1083) | Napi::Array
  function Init (line 1210) | Napi::Object

FILE: src/modules/node-ddcci/index.js
  method getBrightness (line 45) | getBrightness(monitorId) {
  method getMaxBrightness (line 49) | getMaxBrightness(monitorId) {
  method getContrast (line 53) | getContrast(monitorId) {
  method getMaxContrast (line 57) | getMaxContrast(monitorId) {
  method setBrightness (line 61) | setBrightness(monitorId, level) {
  method setContrast (line 69) | setContrast(monitorId, level) {
  method getCapabilities (line 79) | getCapabilities(monitorId) {
  method getCapabilitiesRaw (line 83) | getCapabilitiesRaw(monitorId) {
  function parseCapabilitiesString (line 88) | function parseCapabilitiesString(report = "") {

FILE: src/modules/tt-windows-utils/windows_app_startup.cc
  function StartupTask (line 11) | StartupTask getStartupTask() {
  function Enable (line 36) | Napi::Boolean Enable(const Napi::CallbackInfo &info) {
  function Disable (line 49) | Napi::Boolean Disable(const Napi::CallbackInfo &info) {
  function Init (line 61) | Napi::Object Init(Napi::Env env, Napi::Object exports) {

FILE: src/modules/tt-windows-utils/windows_media_status.cc
  function getPlaybackStatus (line 19) | Napi::String getPlaybackStatus(const Napi::CallbackInfo &info) {
  function getPlaybackInfo (line 61) | Napi::Object getPlaybackInfo(const Napi::CallbackInfo &info) {
  function Init (line 136) | Napi::Object Init(Napi::Env env, Napi::Object exports) {

FILE: src/modules/tt-windows-utils/windows_power_events.cc
  function GUIDToString (line 4) | std::string GUIDToString(const GUID guid) {
  function GetPowerSetting (line 13) | Napi::Object GetPowerSetting(const Napi::CallbackInfo& info) {
  function RegisterPowerSettingNotifications (line 73) | Napi::Boolean RegisterPowerSettingNotifications(const Napi::CallbackInfo...
  function Init (line 98) | Napi::Object Init(Napi::Env env, Napi::Object exports) {

FILE: src/modules/tt-windows-utils/windows_window_material.cc
  function SetWindowMaterial (line 6) | Napi::Boolean SetWindowMaterial(const Napi::CallbackInfo &info) {
  function SetWindowAttribute (line 20) | Napi::Boolean SetWindowAttribute(const Napi::CallbackInfo &info) {
  function Init (line 29) | Napi::Object Init(Napi::Env env, Napi::Object exports) {

FILE: src/modules/tt-windows-utils/windows_window_utils.cc
  function SetWindowPosition (line 4) | Napi::Boolean SetWindowPosition(const Napi::CallbackInfo& info) {
  function RectToObj (line 18) | Napi::Object RectToObj(Napi::Env env, RECT rect) {
  function GetWindowPosition (line 29) | Napi::Object GetWindowPosition(const Napi::CallbackInfo& info) {
  function GetClientPosition (line 36) | Napi::Object GetClientPosition(const Napi::CallbackInfo& info) {
  function GetWindowFullscreen (line 43) | Napi::Boolean GetWindowFullscreen(const Napi::CallbackInfo& info)
  function GetForegroundWin (line 62) | Napi::Number GetForegroundWin(const Napi::CallbackInfo& info) {
  function SetForegroundWin (line 68) | Napi::Boolean SetForegroundWin(const Napi::CallbackInfo& info) {
  function GetWinLong (line 76) | Napi::Number GetWinLong(const Napi::CallbackInfo& info) {
  function Init (line 85) | Napi::Object Init(Napi::Env env, Napi::Object exports) {

FILE: src/modules/win32-displayconfig/index.d.ts
  class Win32Error (line 6) | class Win32Error extends Error {
  type AdapterId (line 10) | interface AdapterId {
  type DisplayConfigFractional (line 15) | interface DisplayConfigFractional {
  type SourcePathInfo (line 20) | interface SourcePathInfo {
  type TargetPathInfo (line 27) | interface TargetPathInfo {
  type PathInfoValue (line 40) | interface PathInfoValue {
  type PathInfo (line 46) | interface PathInfo {
  type DisplayConfigPosition (line 51) | interface DisplayConfigPosition {
  type SourceMode (line 56) | interface SourceMode {
  type SourceModeInfo (line 63) | interface SourceModeInfo {
  type PixelRate (line 70) | interface PixelRate {
  type DisplayConfigSize (line 75) | interface DisplayConfigSize {
  type TargetVideoSignalInfo (line 80) | interface TargetVideoSignalInfo {
  type TargetMode (line 90) | interface TargetMode {
  type TargetModeInfo (line 94) | interface TargetModeInfo {
  type ModeInfoValue (line 101) | type ModeInfoValue = SourceModeInfo | TargetModeInfo;
  type ModeInfo (line 103) | interface ModeInfo {
  type NameInfo (line 108) | interface NameInfo {
  type QueryDisplayConfigResults (line 119) | interface QueryDisplayConfigResults {
  type ConfigId (line 127) | interface ConfigId {
  type ExtractedDisplayConfig (line 132) | interface ExtractedDisplayConfig {
  type ToggleEnabledDisplayArgs (line 150) | interface ToggleEnabledDisplayArgs {
  type DisplayResotrationConfigurationEntry (line 160) | interface DisplayResotrationConfigurationEntry {
  type RestoreDisplayConfigArgs (line 171) | interface RestoreDisplayConfigArgs {
  type DisplayChangeListener (line 180) | type DisplayChangeListener = {
  class VerticalRefreshRateContext (line 192) | class VerticalRefreshRateContext {

FILE: src/modules/win32-displayconfig/index.js
  class Win32Error (line 13) | class Win32Error extends Error {
    method constructor (line 14) | constructor(code) {
  function win32_toggleEnabledDisplays (line 331) | async function win32_toggleEnabledDisplays(args) {
  function setSubtract (line 379) | function setSubtract(left, right) {
  function devicePathLookupForEnabledDisplayConfig (line 389) | function devicePathLookupForEnabledDisplayConfig(conf) {
  function win32_restoreDisplayConfig (line 445) | async function win32_restoreDisplayConfig(configs, persistent) {
  function updateDisplayStateAndNotifyCallbacks (line 561) | async function updateDisplayStateAndNotifyCallbacks() {
  function setupListenForDisplayChanges (line 576) | function setupListenForDisplayChanges() {
  class VerticalRefreshRateContext (line 639) | class VerticalRefreshRateContext {
    method constructor (line 640) | constructor() {
    method findVerticalRefreshRateForDisplayPoint (line 705) | async findVerticalRefreshRateForDisplayPoint(x, y) {
    method close (line 724) | close() {

FILE: src/modules/win32-displayconfig/win32-displayconfig.cc
  type Win32DeviceNameInfo (line 17) | struct Win32DeviceNameInfo {
  type Win32QueryDisplayConfigResults (line 31) | struct Win32QueryDisplayConfigResults {
    method Win32QueryDisplayConfigResults (line 32) | Win32QueryDisplayConfigResults(UINT32 cPathInfo, UINT32 cModeInfo)
    type Win32DeviceNameInfo (line 41) | struct Win32DeviceNameInfo
  type Win32TransientDeviceId (line 46) | struct Win32TransientDeviceId {
  type Win32DeviceConfigToggleEnabled (line 51) | struct Win32DeviceConfigToggleEnabled {
    method Win32DeviceConfigToggleEnabled (line 52) | Win32DeviceConfigToggleEnabled() : enable(), disable() {}
    type Win32TransientDeviceId (line 55) | struct Win32TransientDeviceId
    type Win32TransientDeviceId (line 56) | struct Win32TransientDeviceId
  type Win32RestoreDisplayConfigDevice (line 59) | struct Win32RestoreDisplayConfigDevice {
    type Win32TransientDeviceId (line 60) | struct Win32TransientDeviceId
    type Win32TransientDeviceId (line 61) | struct Win32TransientDeviceId
  class Win32DisplayChangeContext (line 69) | class Win32DisplayChangeContext {
    method Win32DisplayChangeContext (line 71) | Win32DisplayChangeContext(Napi::Env env, Napi::Function &callback) : r...
    method DWORD (line 82) | DWORD Start() {
    method Stop (line 92) | void Stop() {
  function HandleDisplayChangeError (line 111) | void HandleDisplayChangeError(Napi::Env env, Napi::Function callback, LP...
  function HandleDisplayChangeSuccess (line 118) | void HandleDisplayChangeSuccess(Napi::Env env, Napi::Function callback) {
  function DWORD (line 122) | DWORD RunDisplayChangeContextLoop(LPVOID lpParam) {
  function TransientDeviceIdVectorContains (line 181) | bool TransientDeviceIdVectorContains(const std::vector<struct Win32Trans...
  function AlreadyHasNameInfo (line 197) | bool AlreadyHasNameInfo(const std::vector<struct Win32DeviceNameInfo> &r...
  function AcquireDeviceNames (line 213) | void AcquireDeviceNames(std::shared_ptr<struct Win32QueryDisplayConfigRe...
  function DoQueryDisplayConfig (line 253) | std::shared_ptr<struct Win32QueryDisplayConfigResults> DoQueryDisplayCon...
  function LONG (line 292) | LONG ToggleEnabled(const std::shared_ptr<struct Win32DeviceConfigToggleE...
  function LONG (line 422) | LONG RestoreDeviceConfig(const std::shared_ptr<std::vector<struct Win32R...
  function ConvertLUID (line 464) | Napi::Object ConvertLUID(Napi::Env env, const LUID *luid) {
  function ConvertSourcePathInfo (line 471) | Napi::Object ConvertSourcePathInfo(Napi::Env env, const DISPLAYCONFIG_PA...
  function ConvertVideoOutputTechnology (line 486) | Napi::String ConvertVideoOutputTechnology(Napi::Env env, DISPLAYCONFIG_V...
  function ConvertRotation (line 529) | Napi::Number ConvertRotation(Napi::Env env, DISPLAYCONFIG_ROTATION rotat...
  function ConvertScaling (line 542) | Napi::String ConvertScaling(Napi::Env env, DISPLAYCONFIG_SCALING scaling) {
  function ConvertRational (line 559) | Napi::Object ConvertRational(Napi::Env env, const DISPLAYCONFIG_RATIONAL...
  function ConvertScanLineOrdering (line 566) | Napi::String ConvertScanLineOrdering(Napi::Env env, DISPLAYCONFIG_SCANLI...
  function ConvertTargetPathInfo (line 579) | Napi::Object ConvertTargetPathInfo(Napi::Env env, const DISPLAYCONFIG_PA...
  function ConvertPathInfo (line 602) | Napi::Object ConvertPathInfo(Napi::Env env, const DISPLAYCONFIG_PATH_INF...
  function ConvertUInt64 (line 611) | Napi::Object ConvertUInt64(Napi::Env env, UINT64 num) {
  function Convert2DRegion (line 620) | Napi::Object Convert2DRegion(Napi::Env env, const DISPLAYCONFIG_2DREGION...
  function ConvertVideoSignalInfo (line 627) | Napi::Object ConvertVideoSignalInfo(Napi::Env env, const DISPLAYCONFIG_V...
  function ConvertTargetMode (line 639) | Napi::Object ConvertTargetMode(Napi::Env env, const DISPLAYCONFIG_TARGET...
  function ConvertPixelFormat (line 645) | Napi::Value ConvertPixelFormat(Napi::Env env, DISPLAYCONFIG_PIXELFORMAT ...
  function ConvertModeInfoType (line 660) | Napi::Value ConvertModeInfoType(Napi::Env env, DISPLAYCONFIG_MODE_INFO_T...
  function ConvertPointL (line 673) | Napi::Object ConvertPointL(Napi::Env env, const POINTL &pointl) {
  function ConvertSourceMode (line 680) | Napi::Object ConvertSourceMode(Napi::Env env, const DISPLAYCONFIG_SOURCE...
  function ConvertRectL (line 689) | Napi::Object ConvertRectL(Napi::Env env, const RECTL &rectl) {
  function ConvertDesktopImageInfo (line 698) | Napi::Object ConvertDesktopImageInfo(Napi::Env env, const DISPLAYCONFIG_...
  function ConvertModeInfo (line 706) | Napi::Object ConvertModeInfo(Napi::Env env, const DISPLAYCONFIG_MODE_INF...
  function ConvertNameInfo (line 727) | Napi::Object ConvertNameInfo(Napi::Env env, const struct Win32DeviceName...
  function ConvertPathsInfo (line 741) | Napi::Array ConvertPathsInfo(Napi::Env env, const std::vector<DISPLAYCON...
  function ConvertModesInfo (line 755) | Napi::Array ConvertModesInfo(Napi::Env env, const std::vector<DISPLAYCON...
  function ConvertNamesInfo (line 769) | Napi::Array ConvertNamesInfo(Napi::Env env, const std::vector<struct Win...
  function ConvertConfigResults (line 777) | Napi::Object ConvertConfigResults(Napi::Env env, const std::shared_ptr<s...
  class Win32QueryDisplayConfigWorker (line 785) | class Win32QueryDisplayConfigWorker : public Napi::AsyncWorker {
    method Win32QueryDisplayConfigWorker (line 787) | Win32QueryDisplayConfigWorker(Napi::Function &callback) : Napi::AsyncW...
    method Execute (line 789) | void Execute() {
    method GetResult (line 793) | std::vector<napi_value> GetResult(Napi::Env env) {
    type Win32QueryDisplayConfigResults (line 805) | struct Win32QueryDisplayConfigResults
  function Win32QueryDisplayConfig (line 808) | Napi::Value Win32QueryDisplayConfig(const Napi::CallbackInfo &info) {
  class Win32ToggleEnabledWorker (line 822) | class Win32ToggleEnabledWorker : public Napi::AsyncWorker {
    method Win32ToggleEnabledWorker (line 824) | Win32ToggleEnabledWorker(Napi::Function &callback, std::shared_ptr<str...
    method Execute (line 827) | void Execute() {
    method GetResult (line 831) | std::vector<napi_value> GetResult(Napi::Env env) {
    type Win32DeviceConfigToggleEnabled (line 837) | struct Win32DeviceConfigToggleEnabled
  function ExtractTransientDeviceId (line 841) | bool ExtractTransientDeviceId(Napi::Value val, Win32TransientDeviceId *c...
  function ExtractToggleEnabledDisplayArguments (line 866) | std::shared_ptr<struct Win32DeviceConfigToggleEnabled> ExtractToggleEnab...
  function Win32ToggleEnabledDisplays (line 894) | Napi::Value Win32ToggleEnabledDisplays(const Napi::CallbackInfo &info) {
  class Win32RestoreDisplayConfigWorker (line 911) | class Win32RestoreDisplayConfigWorker : public Napi::AsyncWorker {
    method Win32RestoreDisplayConfigWorker (line 913) | Win32RestoreDisplayConfigWorker(Napi::Function &callback, std::shared_...
    method Execute (line 916) | void Execute() {
    method GetResult (line 920) | std::vector<napi_value> GetResult(Napi::Env env) {
    type Win32RestoreDisplayConfigDevice (line 926) | struct Win32RestoreDisplayConfigDevice
  function BOOL (line 931) | BOOL ExtractRestoreDisplayConfigEntry(Napi::Env env, Napi::Object obj, s...
  function Win32RestoreDisplayConfig (line 967) | Napi::Value Win32RestoreDisplayConfig(const Napi::CallbackInfo &info) {
  function Win32ListenForDisplayChanges (line 1001) | Napi::Value Win32ListenForDisplayChanges(const Napi::CallbackInfo &info) {
  function Win32StopListeningForDisplayChanges (line 1018) | Napi::Value Win32StopListeningForDisplayChanges(const Napi::CallbackInfo...
  function Init (line 1032) | Napi::Object Init(Napi::Env env, Napi::Object exports) {

FILE: src/modules/windows-hdr/windows-hdr.cc
  type DISPLAYCONFIG_DEVICE_INFO_TYPE_INTERNAL (line 9) | enum DISPLAYCONFIG_DEVICE_INFO_TYPE_INTERNAL {
  type _DISPLAYCONFIG_SET_SDR_WHITE_LEVEL (line 13) | struct _DISPLAYCONFIG_SET_SDR_WHITE_LEVEL {
  function LONG (line 19) | LONG pathSetSdrWhite(DISPLAYCONFIG_PATH_INFO path, int nits) {
  type Display (line 32) | struct Display {
  function wcharToString (line 43) | std::string wcharToString(const wchar_t* wstr, boolean hasNullTerminator) {
  function boolean (line 54) | boolean setSDRBrightness(DISPLAYCONFIG_PATH_INFO target, int desiredNits...
  function getDisplays (line 83) | std::map<std::string, Display> getDisplays() {
  function nodeGetDisplays (line 187) | Napi::Array nodeGetDisplays(const Napi::CallbackInfo& info) {
  function nodeSetSDRBrightness (line 216) | Napi::Boolean nodeSetSDRBrightness(const Napi::CallbackInfo& info) {
  function Init (line 237) | Napi::Object Init(Napi::Env env, Napi::Object exports) {

FILE: src/modules/wmi-bridge/index.js
  class WMIBridge (line 5) | class WMIBridge {
    method constructor (line 6) | constructor() {}

FILE: src/modules/wmi-bridge/wmi-bridge.cc
  function p (line 20) | void p(string str)
  function wmiConnect (line 26) | bool wmiConnect()
  function bstr_to_str (line 55) | std::string bstr_to_str(BSTR bstr)
  function string (line 70) | string getWMIClassUINTString(HRESULT &hr, VARIANT &vtProp)
  function getWMIBrightness (line 110) | Napi::Object getWMIBrightness(const Napi::CallbackInfo &info)
  function getWMIMonitors (line 200) | Napi::Object getWMIMonitors(const Napi::CallbackInfo &info)
  function setWMIBrightness (line 311) | bool setWMIBrightness(int brightness)
  function setBrightness (line 508) | Napi::Boolean setBrightness(const Napi::CallbackInfo &info)
  function getBrightness (line 532) | Napi::Object getBrightness(const Napi::CallbackInfo &info)
  function getMonitors (line 546) | Napi::Object getMonitors(const Napi::CallbackInfo &info)
  function Init (line 559) | Napi::Object Init(Napi::Env env, Napi::Object exports)

FILE: src/panel-preload.js
  function getArgumentVars (line 22) | function getArgumentVars() {
  function setPanelVisibility (line 35) | function setPanelVisibility(visible) {
  function requestMonitors (line 78) | function requestMonitors() {
  function requestAccent (line 82) | function requestAccent() {
  function updateBrightness (line 87) | function updateBrightness(index, level) {
  function detectSunValley (line 95) | function detectSunValley() {
  function openSettings (line 117) | function openSettings() {
  function sendSettings (line 125) | function sendSettings(newSettings) {
  function requestSettings (line 132) | function requestSettings() {
  function sendHeight (line 136) | function sendHeight(height) {
  function pauseMonitorUpdates (line 140) | function pauseMonitorUpdates() {
  function panelAnimationDone (line 144) | function panelAnimationDone() {
  function shouldSendHeightUpdate (line 158) | function shouldSendHeightUpdate() {
  function turnOffDisplays (line 171) | function turnOffDisplays() {
  function installUpdate (line 179) | function installUpdate() {
  function dismissUpdate (line 184) | function dismissUpdate() {

FILE: src/parcelAPI.js
  function clearDirectory (line 26) | function clearDirectory(relativePath) {
  function runParcel (line 36) | async function runParcel(mode = "dev", logLevel = null) {

FILE: src/settings-preload.js
  function getArgumentVars (line 3) | function getArgumentVars() {
  function requestMonitors (line 13) | function requestMonitors(fullRefresh = false) {
  function requestAccent (line 21) | function requestAccent() {
  function updateBrightness (line 26) | function updateBrightness(index, level) {
  function sendSettings (line 41) | function sendSettings(newSettings = {}) {
  function sendSettingsImmediate (line 52) | function sendSettingsImmediate(newSettings = {}) {
  function actuallySendSettings (line 59) | function actuallySendSettings() {
  function requestSettings (line 67) | function requestSettings() {
  function resetSettings (line 71) | function resetSettings() {
  function detectSunValley (line 75) | function detectSunValley() {
  function openURL (line 97) | function openURL(url) {
  function getUpdate (line 101) | function getUpdate() {
  function checkForUpdates (line 106) | function checkForUpdates() {
  function getSunCalcTimes (line 244) | function getSunCalcTimes(lat, long) {

FILE: src/settings.js
  function updateMicaPosition (line 7) | function updateMicaPosition(pos = [0, 0]) {

FILE: src/wmi-bridge-test.js
  function readInstanceName (line 5) | function readInstanceName(insName) {
  function wait4s (line 10) | function wait4s() {
Condensed preview — 158 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,539K chars).
[
  {
    "path": ".babelrc",
    "chars": 58,
    "preview": "{\n  \"presets\": [\"@babel/preset-react\"],\n  \"plugins\": []\n}\n"
  },
  {
    "path": ".gitattributes",
    "chars": 66,
    "preview": "# Auto detect text files and perform LF normalization\n* text=auto\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "chars": 802,
    "preview": "# These are supported funding model platforms\n\ngithub: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [u"
  },
  {
    "path": ".github/workflows/ci.yml",
    "chars": 3423,
    "preview": "name: CI Build\n\non: [push, pull_request]\n\nenv:\n BRANCH_NAME: ${{ github.head_ref || github.ref_name }} \n\njobs:\n  build:\n"
  },
  {
    "path": ".gitignore",
    "chars": 252,
    "preview": "# dependencies\nnode_modules/\n\n# production\nbuild/\ndist/\n\n# misc\n.cache\n.DS_Store\n.env.local\n.env.development.local\n.env."
  },
  {
    "path": ".sassrc",
    "chars": 46,
    "preview": "{\n    silenceDeprecations: [\"legacy-js-api\"]\n}"
  },
  {
    "path": ".vscode/settings.json",
    "chars": 2085,
    "preview": "{\n    \"files.associations\": {\n        \"algorithm\": \"cpp\",\n        \"array\": \"cpp\",\n        \"atomic\": \"cpp\",\n        \"bit\""
  },
  {
    "path": "LICENSE",
    "chars": 1070,
    "preview": "MIT License\n\nCopyright (c) 2019 Xander Frangos\n\nPermission is hereby granted, free of charge, to any person obtaining a "
  },
  {
    "path": "README.md",
    "chars": 9769,
    "preview": "<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/xanderfrangos/twinkle-tray/master/src/assets/logo.png\" "
  },
  {
    "path": "package.json",
    "chars": 7739,
    "preview": "{\n  \"name\": \"twinkle-tray\",\n  \"version\": \"1.17.2\",\n  \"description\": \"Manage the brightness of monitors from your system "
  },
  {
    "path": "resources/appx/extensions.xml",
    "chars": 370,
    "preview": "<!-- build/appx/extensions.xml -->\n<uap5:Extension\n  xmlns:uap5=\"http://schemas.microsoft.com/appx/manifest/uap/windows1"
  },
  {
    "path": "resources/nsis/installer.nsh",
    "chars": 133,
    "preview": " !macro customUnInstall\n   DeleteRegValue HKCU \"Software\\Microsoft\\Windows\\CurrentVersion\\Run\" \"electron.app.Twinkle Tra"
  },
  {
    "path": "src/Monitors.js",
    "chars": 51100,
    "preview": "const tag = \"\\x1b[47m M \\x1b[0m\";\nconst oLog = console.log\nconsole.log = (...args) => { args.unshift(tag); oLog(...args)"
  },
  {
    "path": "src/Translate.js",
    "chars": 1150,
    "preview": "class Translate {\n    constructor(localizationData = {}, fallbackData = {}) {\n        this.localizationData = localizati"
  },
  {
    "path": "src/TranslateReact.js",
    "chars": 648,
    "preview": "import Translate from \"./Translate\"\nimport React from \"react\";\n\nclass TranslateReact extends Translate {\n\n    getHTML(ke"
  },
  {
    "path": "src/Utils.js",
    "chars": 11206,
    "preview": "const path = require('path');\nconst fs = require('fs')\n\nfunction udpSendCommand(type, data, port = 14715, key) {\n    ret"
  },
  {
    "path": "src/components/BrightnessPanel.jsx",
    "chars": 17127,
    "preview": "import React, { memo, useEffect, useMemo, useState } from \"react\";\nimport Slider from \"./Slider\";\nimport DDCCISliders fr"
  },
  {
    "path": "src/components/DDCCISliders.jsx",
    "chars": 5510,
    "preview": "import React from \"react\"\nimport { useObject } from \"../hooks/useObject\"\nimport Slider from \"./Slider\"\n\nexport default f"
  },
  {
    "path": "src/components/HDRSliders.jsx",
    "chars": 949,
    "preview": "import React, { useState } from \"react\"\nimport { useObject } from \"../hooks/useObject\"\nimport Slider from \"./Slider\"\n\nex"
  },
  {
    "path": "src/components/IntroWindow.jsx",
    "chars": 1057,
    "preview": "import React, { PureComponent } from \"react\";\nimport TranslateReact from \"../TranslateReact\"\nimport AppLogo from \"../ass"
  },
  {
    "path": "src/components/MonitorFeatures.jsx",
    "chars": 17426,
    "preview": "import React, { useState, useEffect } from \"react\"\nimport { useObject } from \"../hooks/useObject\"\nimport { SettingsOptio"
  },
  {
    "path": "src/components/MonitorInfo.jsx",
    "chars": 7225,
    "preview": "import React, { useState, useEffect } from \"react\"\nimport Slider from \"./Slider\"\nimport TranslateReact from \"../Translat"
  },
  {
    "path": "src/components/SafeRender.jsx",
    "chars": 738,
    "preview": "import React from \"react\";\n\nexport default class SafeRender extends React.Component {\n    constructor(props) {\n      sup"
  },
  {
    "path": "src/components/SettingsOption.jsx",
    "chars": 2887,
    "preview": "import React, { useState, useEffect } from \"react\"\nimport SafeRender from \"./SafeRender\"\n\nexport function SettingsOption"
  },
  {
    "path": "src/components/SettingsWindow.jsx",
    "chars": 103426,
    "preview": "/*\n\nHi,\nIf you're reading this, you probably want to know how this component works.\nThis component is not good. Mistakes"
  },
  {
    "path": "src/components/Slider.jsx",
    "chars": 3260,
    "preview": "import React from \"react\";\nimport { useEffect, Component } from \"react\"\nimport PropTypes from 'prop-types';\n\nexport defa"
  },
  {
    "path": "src/components/Titlebar.jsx",
    "chars": 1097,
    "preview": "import React from \"react\";\n\nexport default class Titlebar extends React.Component {\n\n  constructor(props) {\n    super(pr"
  },
  {
    "path": "src/css/common.scss",
    "chars": 1235,
    "preview": ".button {\n    background: var(--button-background);\n    border: 2px solid var(--button-background);\n    line-height: 0;\n"
  },
  {
    "path": "src/css/intro.scss",
    "chars": 2153,
    "preview": "body,\nhtml {\n    background: transparent;\n}\n\nbody {\n    padding: 80px;\n    box-sizing: border-box;\n}\n\n.page {\n    backgr"
  },
  {
    "path": "src/css/mica.scss",
    "chars": 993,
    "preview": "#mica {\n    position: absolute !important;\n    top: 0;\n    left: 0;\n    width: 100vw;\n    height: 100vh;\n    overflow: h"
  },
  {
    "path": "src/css/page.scss",
    "chars": 26086,
    "preview": "@use \"common.scss\";\n\n$sidebarWidth: 300px;\n$sidebarWidthSmall: 44px;\n\nhtml,\nbody {\n    background: transparent;\n}\n\n#sett"
  },
  {
    "path": "src/css/panel.scss",
    "chars": 15742,
    "preview": "@use \"common.scss\";\n\n//\n// Defaults\n//\n\nhtml,\nbody {\n    background: transparent;\n    min-height: 100vh;\n    overflow: h"
  },
  {
    "path": "src/css/settings-option.scss",
    "chars": 8737,
    "preview": "body[data-is-win11=\"true\"], body[data-is-win11=\"false\"] {\n    .settings-option-elem {\n        width: 100%;\n        margi"
  },
  {
    "path": "src/css/slider.scss",
    "chars": 5761,
    "preview": "//\n// Inputs\n//\n\n.input--range {\n    display: flex;\n    flex-direction: row;\n    justify-content: space-between;\n    ali"
  },
  {
    "path": "src/css/vars.scss",
    "chars": 6921,
    "preview": "//\n// Variables\n//\n\n:root {\n    --system-accent-color: hsl(200, 80%, 83%);\n    --system-accent-light: hsl(200, 80%, 83%)"
  },
  {
    "path": "src/electron.js",
    "chars": 148808,
    "preview": "const { app } = require('electron')\nconst fs = require('fs')\n\nconst path = require('path');\n\nlet isDev = app.commandLine"
  },
  {
    "path": "src/hooks/useObject.js",
    "chars": 329,
    "preview": "import { useState } from \"react\"\n\nexport function useObject(initialState = {}) {\n\n    const [state, setState] = useState"
  },
  {
    "path": "src/html/index.html",
    "chars": 440,
    "preview": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"UTF-8\" />\n    <title>Twinkle Tray Panel</title>\n    <link rel=\"styles"
  },
  {
    "path": "src/html/intro.html",
    "chars": 532,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-w"
  },
  {
    "path": "src/html/settings.html",
    "chars": 1366,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-w"
  },
  {
    "path": "src/intro-preload.js",
    "chars": 1226,
    "preview": "const { ipcRenderer: ipc } = require('electron');\n\nwindow.closeIntro = () => {\n    ipc.send('close-intro')\n}\n\nfunction d"
  },
  {
    "path": "src/intro.js",
    "chars": 194,
    "preview": "import React from \"react\";\nimport { createRoot } from 'react-dom/client';\nimport IntroWindow from \"./components/IntroWin"
  },
  {
    "path": "src/localization/ar.json",
    "chars": 10693,
    "preview": "{\n    \"LANGUAGE\": \"Arabic\",\n    \"GENERIC_OK\": \"اوكي\",\n    \"GENERIC_CANCEL\": \"إلغاء\",\n    \"GENERIC_SAVE\": \"حفظ\",\n    \"GEN"
  },
  {
    "path": "src/localization/az.json",
    "chars": 11658,
    "preview": "{\n    \"LANGUAGE\": \"Azərbaycan dili\",\n    \"GENERIC_OK\": \"Tamam\",\n    \"GENERIC_CANCEL\": \"Ləğv et\",\n    \"GENERIC_SAVE\": \"Ya"
  },
  {
    "path": "src/localization/bn.json",
    "chars": 11433,
    "preview": "{\n    \"LANGUAGE\": \"ইংরেজি\",\n    \"GENERIC_OK\": \"ঠিক আছে\",\n    \"GENERIC_CANCEL\": \"বাতিল করুন\",\n    \"GENERIC_SAVE\": \"সংরক্ষ"
  },
  {
    "path": "src/localization/ckb.json",
    "chars": 12923,
    "preview": "{\n    \"LANGUAGE\": \"کوردی (ناوەندی)\",\n    \"GENERIC_OK\": \"باشە\",\n    \"GENERIC_CANCEL\": \"هەڵوەشاندنەوە\",\n    \"GENERIC_SAVE\""
  },
  {
    "path": "src/localization/cs.json",
    "chars": 14835,
    "preview": "{\n    \"LANGUAGE\": \"Čeština\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Storno\",\n    \"GENERIC_SAVE\": \"Uložit\",\n    \""
  },
  {
    "path": "src/localization/de.json",
    "chars": 22661,
    "preview": "{\n    \"LANGUAGE\": \"Deutsch\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Abbrechen\",\n    \"GENERIC_SAVE\": \"Speichern\","
  },
  {
    "path": "src/localization/el.json",
    "chars": 20143,
    "preview": "{\n    \"LANGUAGE\": \"Greek\",\n    \"GENERIC_OK\": \"ΟΚ\",\n    \"GENERIC_CANCEL\": \"Ματαίωση\",\n    \"GENERIC_SAVE\": \"Αποθήκευση\",\n "
  },
  {
    "path": "src/localization/en-GB.json",
    "chars": 19859,
    "preview": "{\n    \"LANGUAGE\": \"English (UK)\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Cancel\",\n    \"GENERIC_SAVE\": \"Save\",\n  "
  },
  {
    "path": "src/localization/en.json",
    "chars": 19850,
    "preview": "{\n    \"LANGUAGE\": \"English\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Cancel\",\n    \"GENERIC_SAVE\": \"Save\",\n    \"GE"
  },
  {
    "path": "src/localization/es.json",
    "chars": 22423,
    "preview": "{\n    \"LANGUAGE\": \"Español\",\n    \"GENERIC_OK\": \"Aceptar\",\n    \"GENERIC_CANCEL\": \"Cancelar\",\n    \"GENERIC_SAVE\": \"Guardar"
  },
  {
    "path": "src/localization/fa.json",
    "chars": 11988,
    "preview": "{\n    \"LANGUAGE\": \"پارسی\",\n    \"GENERIC_OK\": \"پذیرفتن\",\n    \"GENERIC_CANCEL\": \"لغو\",\n    \"GENERIC_SAVE\": \"ذخیره\",\n    \"G"
  },
  {
    "path": "src/localization/fi.json",
    "chars": 19462,
    "preview": "{\n    \"LANGUAGE\": \"Suomi\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Peruuta\",\n    \"GENERIC_SAVE\": \"Tallenna\",\n    "
  },
  {
    "path": "src/localization/fr.json",
    "chars": 16951,
    "preview": "{\n    \"LANGUAGE\": \"Français\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Annuler\",\n    \"GENERIC_SAVE\": \"Enregistrer\""
  },
  {
    "path": "src/localization/he.json",
    "chars": 18009,
    "preview": "{\n    \"LANGUAGE\": \"עברית\",\n    \"GENERIC_OK\": \"אישור\",\n    \"GENERIC_CANCEL\": \"ביטול\",\n    \"GENERIC_SAVE\": \"שמירה\",\n    \"G"
  },
  {
    "path": "src/localization/hi.json",
    "chars": 11237,
    "preview": "{\n    \"LANGUAGE\": \"हिंदी\",\n    \"GENERIC_OK\": \"ठीक है\",\n    \"GENERIC_CANCEL\": \"रद्द करना\",\n    \"GENERIC_SAVE\": \"सहेजें\",\n"
  },
  {
    "path": "src/localization/hr.json",
    "chars": 11855,
    "preview": "{\n    \"LANGUAGE\": \"Hrvatski\",\n    \"GENERIC_OK\": \"U redu\",\n    \"GENERIC_CANCEL\": \"Odustani\",\n    \"GENERIC_SAVE\": \"Spremi\""
  },
  {
    "path": "src/localization/hu.json",
    "chars": 21174,
    "preview": "{\n    \"LANGUAGE\": \"magyar\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Mégse\",\n    \"GENERIC_SAVE\": \"Mentés\",\n    \"GE"
  },
  {
    "path": "src/localization/id.json",
    "chars": 17816,
    "preview": "{\n    \"LANGUAGE\": \"Indonesia\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Batal\",\n    \"GENERIC_SAVE\": \"Simpan\",\n    "
  },
  {
    "path": "src/localization/it.json",
    "chars": 22136,
    "preview": "{\n    \"LANGUAGE\": \"Italiano\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Annulla\",\n    \"GENERIC_SAVE\": \"Salva\",\n    "
  },
  {
    "path": "src/localization/ja.json",
    "chars": 13284,
    "preview": "{\n    \"LANGUAGE\": \"日本語\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"キャンセル\",\n    \"GENERIC_SAVE\": \"保存\",\n    \"GENERIC_C"
  },
  {
    "path": "src/localization/ko.json",
    "chars": 14982,
    "preview": "{\n    \"LANGUAGE\": \"한국어\",\n    \"GENERIC_OK\": \"확인\",\n    \"GENERIC_CANCEL\": \"취소\",\n    \"GENERIC_SAVE\": \"저장\",\n    \"GENERIC_CLEA"
  },
  {
    "path": "src/localization/lt.json",
    "chars": 22822,
    "preview": "{\n    \"LANGUAGE\": \"Lietuvių\",\n    \"GENERIC_OK\": \"Gerai\",\n    \"GENERIC_CANCEL\": \"Atšaukti\",\n    \"GENERIC_SAVE\": \"Išsaugot"
  },
  {
    "path": "src/localization/nb.json",
    "chars": 11886,
    "preview": "{\n    \"LANGUAGE\": \"Norwegian Bokmål\",\n    \"GENERIC_OK\": \"Ok\",\n    \"GENERIC_CANCEL\": \"Avbryt\",\n    \"GENERIC_SAVE\": \"Lagre"
  },
  {
    "path": "src/localization/nl.json",
    "chars": 18607,
    "preview": "{\n    \"LANGUAGE\": \"Nederlands\",\n    \"GENERIC_OK\": \"Oké\",\n    \"GENERIC_CANCEL\": \"Annuleren\",\n    \"GENERIC_SAVE\": \"Opslaan"
  },
  {
    "path": "src/localization/pl.json",
    "chars": 21347,
    "preview": "{\n    \"LANGUAGE\": \"Polski\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Anuluj\",\n    \"GENERIC_SAVE\": \"Zapisz\",\n    \"G"
  },
  {
    "path": "src/localization/pt-BR.json",
    "chars": 20350,
    "preview": "{\n    \"LANGUAGE\": \"Inglês\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Cancelar\",\n    \"GENERIC_SAVE\": \"Salvar\",\n    "
  },
  {
    "path": "src/localization/pt.json",
    "chars": 20112,
    "preview": "{\n    \"LANGUAGE\": \"Português\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Cancelar\",\n    \"GENERIC_SAVE\": \"Gravar\",\n "
  },
  {
    "path": "src/localization/ro.json",
    "chars": 12873,
    "preview": "{\n    \"LANGUAGE\": \"Română\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Anulează\",\n    \"GENERIC_SAVE\": \"Salvează\",\n  "
  },
  {
    "path": "src/localization/ru.json",
    "chars": 21286,
    "preview": "{\n    \"LANGUAGE\": \"Russian\",\n    \"GENERIC_OK\": \"ОК\",\n    \"GENERIC_CANCEL\": \"Отмена\",\n    \"GENERIC_SAVE\": \"Сохранить\",\n  "
  },
  {
    "path": "src/localization/sk.json",
    "chars": 18337,
    "preview": "{\n    \"LANGUAGE\": \"Slovenčina\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Zrušiť\",\n    \"GENERIC_SAVE\": \"Uložiť\",\n  "
  },
  {
    "path": "src/localization/sv.json",
    "chars": 17883,
    "preview": "{\n    \"LANGUAGE\": \"Svenska\",\n    \"GENERIC_OK\": \"OK\",\n    \"GENERIC_CANCEL\": \"Avbryt\",\n    \"GENERIC_SAVE\": \"Spara\",\n    \"G"
  },
  {
    "path": "src/localization/ta.json",
    "chars": 18785,
    "preview": "{\n    \"LANGUAGE\": \"ஆங்கிலம்\",\n    \"GENERIC_OK\": \"சரி\",\n    \"GENERIC_CANCEL\": \"ரத்துசெய்\",\n    \"GENERIC_SAVE\": \"சேமி\",\n  "
  },
  {
    "path": "src/localization/th.json",
    "chars": 12123,
    "preview": "{\n    \"LANGUAGE\": \"ภาษาไทย\",\n    \"GENERIC_OK\": \"ตกลง\",\n    \"GENERIC_CANCEL\": \"ยกเลิก\",\n    \"GENERIC_SAVE\": \"บันทึก\",\n   "
  },
  {
    "path": "src/localization/tr.json",
    "chars": 14374,
    "preview": "{\n    \"LANGUAGE\": \"Türkçe\",\n    \"GENERIC_OK\": \"Tamam\",\n    \"GENERIC_CANCEL\": \"İptal\",\n    \"GENERIC_SAVE\": \"Kaydet\",\n    "
  },
  {
    "path": "src/localization/uk.json",
    "chars": 21070,
    "preview": "{\n    \"LANGUAGE\": \"Українська\",\n    \"GENERIC_OK\": \"Гаразд\",\n    \"GENERIC_CANCEL\": \"Скасувати\",\n    \"GENERIC_SAVE\": \"Збер"
  },
  {
    "path": "src/localization/vi.json",
    "chars": 13014,
    "preview": "{\n    \"LANGUAGE\": \"Tiếng Việt\",\n    \"GENERIC_OK\": \"Đồng ý\",\n    \"GENERIC_CANCEL\": \"Huỷ\",\n    \"GENERIC_SAVE\": \"Lưu\",\n    "
  },
  {
    "path": "src/localization/zh-Hant.json",
    "chars": 12390,
    "preview": "{\n    \"LANGUAGE\": \"繁體中文\",\n    \"GENERIC_OK\": \"確認\",\n    \"GENERIC_CANCEL\": \"取消\",\n    \"GENERIC_SAVE\": \"儲存\",\n    \"GENERIC_CLE"
  },
  {
    "path": "src/localization/zh_Hans.json",
    "chars": 13187,
    "preview": "{\n    \"LANGUAGE\": \"简体中文\",\n    \"GENERIC_OK\": \"确定\",\n    \"GENERIC_CANCEL\": \"取消\",\n    \"GENERIC_SAVE\": \"保存\",\n    \"GENERIC_CLE"
  },
  {
    "path": "src/modules/acrylic/.gitignore",
    "chars": 47,
    "preview": "node_modules\n*.log*\nbuild\n.vscode/ipch\n.history"
  },
  {
    "path": "src/modules/acrylic/acrylic.cc",
    "chars": 4570,
    "preview": "#include <napi.h>\n#include <dwmapi.h>\n\nenum AccentState {\n    ACCENT_DISABLED = 0,\n    ACCENT_ENABLE_GRADIENT = 1,\n    A"
  },
  {
    "path": "src/modules/acrylic/binding.gyp",
    "chars": 398,
    "preview": "{\n  \"targets\": [\n    {\n      \"target_name\": \"acrylic\",\n      \"cflags!\": [ \"-fno-exceptions\" ],\n      \"cflags_cc!\": [ \"-f"
  },
  {
    "path": "src/modules/acrylic/index.js",
    "chars": 82,
    "preview": "\"use strict\";\nconst addon = require(\"bindings\")(\"acrylic\");\nmodule.exports = addon"
  },
  {
    "path": "src/modules/acrylic/package.json",
    "chars": 458,
    "preview": "{\n  \"name\": \"acrylic\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"start\": \"npm"
  },
  {
    "path": "src/modules/node-active-window/.eslintrc.json",
    "chars": 637,
    "preview": "{\n\t\"parser\": \"@typescript-eslint/parser\",\n\t\"env\": {\n\t\t\"es2021\": true,\n\t\t\"node\": true\n\t},\n\t\"extends\": [\n\t\t\"eslint:recomme"
  },
  {
    "path": "src/modules/node-active-window/.gitignore",
    "chars": 105,
    "preview": "# node modules\nnode_modules/\n\n# eslint cache\n.eslintcache\n\n# build artifacts\n!dist/\n**/build/\nprebuilds/\n"
  },
  {
    "path": "src/modules/node-active-window/.prettierrc.json",
    "chars": 125,
    "preview": "{\n\t\"semi\": true,\n\t\"useTabs\": true,\n\t\"tabWidth\": 4,\n\t\"singleQuote\": true,\n\t\"trailingComma\": \"none\",\n\t\"arrowParens\": \"avoi"
  },
  {
    "path": "src/modules/node-active-window/CHANGELOG.md",
    "chars": 18491,
    "preview": "# Changelog\n\nAll notable changes to this project will be documented in this file. See [standard-version](https://github."
  },
  {
    "path": "src/modules/node-active-window/LICENSE",
    "chars": 35149,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "src/modules/node-active-window/README.md",
    "chars": 21929,
    "preview": "# Node Active Window\n\n[![NPM](https://img.shields.io/npm/v/@paymoapp/active-window)](https://www.npmjs.com/package/@paym"
  },
  {
    "path": "src/modules/node-active-window/binding.gyp",
    "chars": 809,
    "preview": "{\n\t\"targets\": [\n\t\t{\n\t\t\t\"target_name\": \"PaymoActiveWindow\",\n\t\t\t\"conditions\": [\n\t\t\t\t[\"OS=='win'\", {\n\t\t\t\t\t\"sources\": [\n\t\t\t\t"
  },
  {
    "path": "src/modules/node-active-window/dist/index.d.ts",
    "chars": 143,
    "preview": "import type { IActiveWindow } from './types';\ndeclare const ActiveWindow: IActiveWindow;\nexport * from './types';\nexport"
  },
  {
    "path": "src/modules/node-active-window/dist/index.js",
    "chars": 3228,
    "preview": "\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n    if ("
  },
  {
    "path": "src/modules/node-active-window/dist/types.d.ts",
    "chars": 883,
    "preview": "export interface NativeWindowInfo {\n    title: string;\n    application: string;\n    path: string;\n    pid: number;\n    i"
  },
  {
    "path": "src/modules/node-active-window/dist/types.js",
    "chars": 77,
    "preview": "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n"
  },
  {
    "path": "src/modules/node-active-window/module/windows/demo/Makefile",
    "chars": 1440,
    "preview": "LIBDIR=..\\src\nBUILDDIR=build\n\nCLFLAGS=/std:c++17\nLIBS=User32.lib Shell32.lib Version.lib Shlwapi.lib Gdiplus.lib Gdi32.l"
  },
  {
    "path": "src/modules/node-active-window/module/windows/demo/main.cpp",
    "chars": 3159,
    "preview": "#include \"../src/ActiveWindow.h\"\n#include <iostream>\n#include <windows.h>\n#include <processthreadsapi.h>\n#include <cstri"
  },
  {
    "path": "src/modules/node-active-window/module/windows/napi/main.cpp",
    "chars": 186,
    "preview": "#include <napi.h>\n#include \"module.h\"\n\nNapi::Object InitAll(Napi::Env env, Napi::Object exports) {\n\treturn module::Init("
  },
  {
    "path": "src/modules/node-active-window/module/windows/napi/module.cpp",
    "chars": 4303,
    "preview": "#include \"module.h\"\n\nNapi::Object module::Init(Napi::Env env, Napi::Object exports) {\n\tenv.SetInstanceData(new PaymoActi"
  },
  {
    "path": "src/modules/node-active-window/module/windows/napi/module.h",
    "chars": 480,
    "preview": "#include <napi.h>\n#include <string>\n#include \"../src/ActiveWindow.h\"\n\n#ifndef _PAYMO_MODULE_H\n#define _PAYMO_MODULE_H\n\nn"
  },
  {
    "path": "src/modules/node-active-window/module/windows/src/ActiveWindow.cpp",
    "chars": 9242,
    "preview": "#include \"ActiveWindow.h\"\n\nnamespace PaymoActiveWindow {\n\tstd::mutex ActiveWindow::smutex;\n\tstd::unordered_map<HWINEVENT"
  },
  {
    "path": "src/modules/node-active-window/module/windows/src/ActiveWindow.h",
    "chars": 2418,
    "preview": "#include <windows.h>\n#include <appmodel.h>\n#include <appxpackaging.h>\n#include <commctrl.h>\n#include <commoncontrols.h>\n"
  },
  {
    "path": "src/modules/node-active-window/package.json",
    "chars": 2373,
    "preview": "{\n  \"name\": \"@paymoapp/active-window\",\n  \"version\": \"1.2.3\",\n  \"description\": \"NodeJS library using native modules to ge"
  },
  {
    "path": "src/modules/node-active-window/src/index.ts",
    "chars": 2365,
    "preview": "import type {\n\tModule,\n\tNativeWindowInfo,\n\tWindowInfo,\n\tIActiveWindow,\n\tInitializeOptions\n} from './types';\n\nconst SUPPO"
  },
  {
    "path": "src/modules/node-active-window/src/types.ts",
    "chars": 806,
    "preview": "export interface NativeWindowInfo {\n\ttitle: string;\n\tapplication: string;\n\tpath: string;\n\tpid: number;\n\ticon: string;\n\t'"
  },
  {
    "path": "src/modules/node-active-window/tsconfig.build.json",
    "chars": 55,
    "preview": "{\n\t\"extends\": \"./tsconfig.json\",\n\t\"include\": [\"src\"]\n}\n"
  },
  {
    "path": "src/modules/node-active-window/tsconfig.json",
    "chars": 463,
    "preview": "{\n\t\"compilerOptions\": {\n\t\t\"target\": \"es6\",\n\t\t\"module\": \"commonjs\",\n\t\t\"lib\": [\"esnext\", \"DOM\"],\n\t\t\"allowJs\": true,\n\t\t\"roo"
  },
  {
    "path": "src/modules/node-ddcci/.clang-format",
    "chars": 245,
    "preview": "BasedOnStyle: Mozilla\n\nAlignOperands: true\nAlignTrailingComments: true\nBreakBeforeBinaryOperators: NonAssignment\nBreakBe"
  },
  {
    "path": "src/modules/node-ddcci/.gitignore",
    "chars": 21,
    "preview": "node_modules/\nbuild/\n"
  },
  {
    "path": "src/modules/node-ddcci/README.md",
    "chars": 2929,
    "preview": "# node-ddcci\n\n## Installation\n\nnode-ddcci is currently only supported on Windows.\n\n````bash\nnpm install @hensm/ddcci\n```"
  },
  {
    "path": "src/modules/node-ddcci/binding.gyp",
    "chars": 451,
    "preview": "{\n    \"targets\": [{\n        \"target_name\": \"ddcci\"\n      , \"sources\": [ \"./ddcci.cc\" ]\n      , \"cflags_cc\": [ \"-std=c++1"
  },
  {
    "path": "src/modules/node-ddcci/ddcci.cc",
    "chars": 40671,
    "preview": "#include <napi.h>\n\n#include \"HighLevelMonitorConfigurationAPI.h\"\n#include \"LowLevelMonitorConfigurationAPI.h\"\n#include \""
  },
  {
    "path": "src/modules/node-ddcci/index.d.ts",
    "chars": 5708,
    "preview": "export function _getVCP (monitorId: string, code: number): number;\nexport function _setVCP (monitorId: string, code: num"
  },
  {
    "path": "src/modules/node-ddcci/index.js",
    "chars": 5846,
    "preview": "\"use strict\";\n\nconst ddcci = require(\"bindings\")(\"ddcci\");\nconst vcp = require(\"./vcp\");\n\nmodule.exports = {\n    vcp\n\n  "
  },
  {
    "path": "src/modules/node-ddcci/package.json",
    "chars": 454,
    "preview": "{\n  \"name\": \"@hensm/ddcci\",\n  \"version\": \"0.1.0\",\n  \"description\": \"NodeJS DDC/CI library\",\n  \"main\": \"index.js\",\n  \"aut"
  },
  {
    "path": "src/modules/node-ddcci/vcp.js",
    "chars": 4813,
    "preview": "/**\n * Full list of MCCS v2.2a VCP codes.\n */\nmodule.exports = {\n    // 8.1 - Preset Functions\n    CODE_PAGE: 0x00\n  , R"
  },
  {
    "path": "src/modules/tt-windows-utils/.gitignore",
    "chars": 47,
    "preview": "node_modules\n*.log*\nbuild\n.vscode/ipch\n.history"
  },
  {
    "path": "src/modules/tt-windows-utils/binding.gyp",
    "chars": 2246,
    "preview": "{\n  \"targets\": [\n    {\n      \"target_name\": \"windows_window_utils\",\n      \"cflags!\": [ ],\n      \"cflags_cc!\": [ ],\n     "
  },
  {
    "path": "src/modules/tt-windows-utils/index.js",
    "chars": 1924,
    "preview": "\"use strict\";\nconst WindowUtils = require(\"bindings\")(\"windows_window_utils\");\nconst PowerEvents = require(\"bindings\")(\""
  },
  {
    "path": "src/modules/tt-windows-utils/package.json",
    "chars": 543,
    "preview": "{\n  \"name\": \"tt-windows-utils\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"sta"
  },
  {
    "path": "src/modules/tt-windows-utils/windows_app_startup.cc",
    "chars": 1834,
    "preview": "#include <napi.h>\n#pragma comment(lib, \"windowsapp\")\n#include <winrt/Windows.ApplicationModel.h>\n#include <winrt/Windows"
  },
  {
    "path": "src/modules/tt-windows-utils/windows_media_status.cc",
    "chars": 4581,
    "preview": "#include <napi.h>\n#pragma comment(lib, \"windowsapp\")\n#include <winrt/Windows.ApplicationModel.h>\n#include <winrt/Windows"
  },
  {
    "path": "src/modules/tt-windows-utils/windows_power_events.cc",
    "chars": 5610,
    "preview": "#include <napi.h>\n#include <windows.h>\n\nstd::string GUIDToString(const GUID guid) {\n    wchar_t source[40];\n    int leng"
  },
  {
    "path": "src/modules/tt-windows-utils/windows_window_material.cc",
    "chars": 1652,
    "preview": "#include <napi.h>\n#include <windows.h>\n#include <dwmapi.h>\n#pragma comment(lib, \"dwmapi.lib\")\n\nNapi::Boolean SetWindowMa"
  },
  {
    "path": "src/modules/tt-windows-utils/windows_window_utils.cc",
    "chars": 4050,
    "preview": "#include <napi.h>\n#include <windows.h>\n\nNapi::Boolean SetWindowPosition(const Napi::CallbackInfo& info) {\n    Napi::Numb"
  },
  {
    "path": "src/modules/win32-displayconfig/.gitignore",
    "chars": 236,
    "preview": "# dependencies\nnode_modules/\n\n# production\nbuild/\ndist/\n\n# misc\n.cache\n.DS_Store\n.env.local\n.env.development.local\n.env."
  },
  {
    "path": "src/modules/win32-displayconfig/CONTRIBUTORS",
    "chars": 24,
    "preview": "Daniel Sweet (@djsweet)\n"
  },
  {
    "path": "src/modules/win32-displayconfig/COPYRIGHT",
    "chars": 1104,
    "preview": "Copyright 2020 individuals listed in the CONTRIBUTORS file of this distribution.\n\nPermission is hereby granted, free of "
  },
  {
    "path": "src/modules/win32-displayconfig/README.md",
    "chars": 10844,
    "preview": "# win32-displayconfig\n\nSimplified Node bindings to the Win32 [Display Device Reference API](https://docs.microsoft.com/e"
  },
  {
    "path": "src/modules/win32-displayconfig/binding.gyp",
    "chars": 716,
    "preview": "{\n    \"variables\": {\n        \"openssl_fips\" : \"0\" \n    },\n    \"targets\": [\n        {\n            \"target_name\": \"win32_d"
  },
  {
    "path": "src/modules/win32-displayconfig/index.d.ts",
    "chars": 4023,
    "preview": "/*\n * index.d.ts: part of the \"win32-displayconfig\" Node package.\n * See the COPYRIGHT file at the top-level directory o"
  },
  {
    "path": "src/modules/win32-displayconfig/index.js",
    "chars": 21971,
    "preview": "/*\n * index.js: part of the \"win32-displayconfig\" Node package.\n * See the COPYRIGHT file at the top-level directory of "
  },
  {
    "path": "src/modules/win32-displayconfig/package.json",
    "chars": 960,
    "preview": "{\n  \"name\": \"win32-displayconfig\",\n  \"version\": \"0.1.0\",\n  \"description\": \"Inspect and reconfigure displays in Windows\","
  },
  {
    "path": "src/modules/win32-displayconfig/scripts/dumpextract.js",
    "chars": 343,
    "preview": "/*\n * scripts/dumpextract.js: part of the \"win32-displayconfig\" Node package.\n * See the COPYRIGHT file at the top-level"
  },
  {
    "path": "src/modules/win32-displayconfig/scripts/dumpquery.js",
    "chars": 532,
    "preview": "/*\n * scripts/dumpquery.js: part of the \"win32-displayconfig\" Node package.\n * See the COPYRIGHT file at the top-level d"
  },
  {
    "path": "src/modules/win32-displayconfig/scripts/watchmouse.js",
    "chars": 926,
    "preview": "/*\n * scripts/watchmouse.js: part of the \"win32-displayconfig\" Node package.\n * See the COPYRIGHT file at the top-level "
  },
  {
    "path": "src/modules/win32-displayconfig/win32-displayconfig.cc",
    "chars": 41986,
    "preview": "/*\n * win32-displayconfig.cc: part of the \"win32-displayconfig\" Node package.\n * See the COPYRIGHT file at the top-level"
  },
  {
    "path": "src/modules/windows-hdr/.gitignore",
    "chars": 47,
    "preview": "node_modules\n*.log*\nbuild\n.vscode/ipch\n.history"
  },
  {
    "path": "src/modules/windows-hdr/binding.gyp",
    "chars": 362,
    "preview": "{\n  \"targets\": [\n    {\n      \"target_name\": \"windows-hdr\",\n      \"cflags!\": [ ],\n      \"cflags_cc!\": [ ],\n      \"conditi"
  },
  {
    "path": "src/modules/windows-hdr/index.js",
    "chars": 165,
    "preview": "\"use strict\";\nconst addon = require(\"bindings\")(\"windows-hdr\");\nmodule.exports = {\n    getDisplays: addon.getDisplays,\n "
  },
  {
    "path": "src/modules/windows-hdr/package.json",
    "chars": 467,
    "preview": "{\n  \"name\": \"windows-hdr\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"start\": "
  },
  {
    "path": "src/modules/windows-hdr/windows-hdr.cc",
    "chars": 8157,
    "preview": "// Code based on https://github.com/ledoge/set_maxtml\n\n#include <napi.h>\n#include <windows.h>\n#include <stdio.h>\n#includ"
  },
  {
    "path": "src/modules/wmi-bridge/binding.gyp",
    "chars": 465,
    "preview": "{\n  \"targets\": [\n    {\n      \"target_name\": \"wmi_bridge\",\n      \"cflags!\": [ ],\n      \"cflags_cc!\": [ ],\n      \"conditio"
  },
  {
    "path": "src/modules/wmi-bridge/example.js",
    "chars": 504,
    "preview": "const WMIBridgeTest = require(\"./index\");\n\nsetInterval(() => {\n    console.log(\"==== TESTING WMIBRIDGE ====\")\n    const "
  },
  {
    "path": "src/modules/wmi-bridge/index.js",
    "chars": 804,
    "preview": "\"use strict\";\nconst addon = require(\"bindings\")(\"wmi_bridge\");\nrequire(\"os\").setPriority(0, require(\"os\").constants.prio"
  },
  {
    "path": "src/modules/wmi-bridge/package.json",
    "chars": 499,
    "preview": "{\n  \"name\": \"wmi-bridge\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"start\": \""
  },
  {
    "path": "src/modules/wmi-bridge/wmi-bridge.cc",
    "chars": 17601,
    "preview": "#define _WIN32_DCOM\n\n#include <napi.h>\n#include <windows.h>\n#include <string>\n#include <iostream>\n#include <WbemCli.h>\n#"
  },
  {
    "path": "src/monitor-rules.json",
    "chars": 129,
    "preview": "{\n    \"ddcBrightnessCodes\": {\n        \"FUS087C\": 107,\n        \"FUS06AB\": 19\n    },\n    \"skipReapply\": [\n        \"DEL41D9"
  },
  {
    "path": "src/panel-preload.js",
    "chars": 14338,
    "preview": "const { ipcRenderer: ipc } = require('electron');\nconst StackBlur = require('stackblur-canvas');\nwindow.StackBlur = Stac"
  },
  {
    "path": "src/panel.js",
    "chars": 1981,
    "preview": "import React from \"react\";\nimport { createRoot } from 'react-dom/client';\nimport BrightnessPanel from \"./components/Brig"
  },
  {
    "path": "src/parcel.js",
    "chars": 426,
    "preview": "const ParcelAPI = require(\"./parcelAPI\")\n\nlet mode\nlet logLevel\ntry {\n    let modeFlagPos = (process.argv.indexOf(\"--mod"
  },
  {
    "path": "src/parcelAPI.js",
    "chars": 1524,
    "preview": "const Bundler = require('parcel-bundler')\nconst Path = require('path')\nconst fs = require(\"fs\")\n\nconst entryFiles = Path"
  },
  {
    "path": "src/settings-preload.js",
    "chars": 8997,
    "preview": "const { ipcRenderer: ipc } = require('electron');\n\nfunction getArgumentVars() {\n    try {\n        const jsVarsString = p"
  },
  {
    "path": "src/settings.js",
    "chars": 758,
    "preview": "import React from \"react\";\nimport { createRoot } from 'react-dom/client';\nimport SettingsWindow from \"./components/Setti"
  },
  {
    "path": "src/utils/BrightnessPanel/getMonitorName.js",
    "chars": 247,
    "preview": "const getMonitorName = (monitor, renames) => {\n    if (Object.keys(renames).indexOf(monitor.id) >= 0 && renames[monitor."
  },
  {
    "path": "src/vcp-codes.js",
    "chars": 4813,
    "preview": "/**\n * Full list of MCCS v2.2a VCP codes.\n */\nmodule.exports = {\n    // 8.1 - Preset Functions\n    CODE_PAGE: 0x00\n  , R"
  },
  {
    "path": "src/wmi-bridge-test.js",
    "chars": 2131,
    "preview": "console.log(\"\\x1b[45mRunning wmi-bridge test...\\x1b[0m\")\nconst wmibridge = require(\"wmi-bridge\");\nrequire(\"os\").setPrior"
  }
]

About this extraction

This page contains the full source code of the xanderfrangos/twinkle-tray GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 158 files (1.4 MB), approximately 401.3k tokens, and a symbol index with 465 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!