87 lines
2.1 KiB
Markdown
87 lines
2.1 KiB
Markdown
# corsair-lcd-control
|
|
|
|
Electron app to control Corsair LCD displays. Monitors system stats (CPU temp, RAM, GPU temp), detects USB devices, and manages preferences.
|
|
|
|
## Prerequisites
|
|
|
|
- [Node.js](https://nodejs.org/) >= 18
|
|
- npm >= 9
|
|
- **Linux**: `libusb-1.0-0-dev`, `build-essential`, `python3`
|
|
- **macOS**: Xcode Command Line Tools (`xcode-select --install`)
|
|
- **Windows**: Build Tools for Visual Studio
|
|
|
|
## Setup
|
|
|
|
```bash
|
|
git clone <repo-url>
|
|
cd corsair-lcd-control
|
|
npm install
|
|
```
|
|
|
|
`postinstall` rebuilds native USB modules for Electron.
|
|
|
|
## Development
|
|
|
|
```bash
|
|
npm start
|
|
```
|
|
|
|
Compiles TypeScript to `build/`, then launches Electron with the compiled output.
|
|
|
|
## Build
|
|
|
|
```bash
|
|
npm run build
|
|
```
|
|
|
|
Compiles TypeScript, then produces platform-specific packages via electron-builder:
|
|
|
|
| Platform | Format |
|
|
|----------|--------|
|
|
| Linux | `.AppImage`, `.deb` |
|
|
| macOS | `.dmg` |
|
|
| Windows | `.exe` (NSIS) |
|
|
|
|
## Lint
|
|
|
|
```bash
|
|
npm run lint
|
|
```
|
|
|
|
Runs ESLint with `typescript-eslint` (`recommendedTypeChecked`) across all `src/` TypeScript files.
|
|
|
|
## Rebuild Native Modules
|
|
|
|
If native modules fail to load after a Node.js or Electron upgrade:
|
|
|
|
```bash
|
|
npm run rebuild
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
├── src/
|
|
│ ├── main.ts # Electron main process
|
|
│ ├── preload.ts # Context bridge for IPC
|
|
│ ├── renderer.ts # Renderer UI logic
|
|
│ ├── index.html # Main window HTML
|
|
│ └── styles.css # Dark theme styles
|
|
├── assets/
|
|
│ └── icon.png # System tray icon
|
|
├── build/ # Compiled JS output (gitignored)
|
|
├── tsconfig.json # TypeScript config
|
|
├── eslint.config.js # ESLint config
|
|
└── package.json
|
|
```
|
|
|
|
## Capabilities
|
|
|
|
- **USB** — enumerates and connects to devices via `usb`
|
|
- **System Tray** — background process with context menu (Show/Hide/Quit)
|
|
- **Preferences** — persisted via `electron-store` (JSON)
|
|
- **File Pickers** — native OS dialogs via Electron's `dialog` API
|
|
- **CPU Temperature** — `systeminformation.cpuTemperature()`
|
|
- **RAM Usage** — `systeminformation.mem()`
|
|
- **GPU Temperature** — `systeminformation.graphics()`
|