Skip to content
mo-browser-appsPublic

About

A reference application for configuring mice and keyboards.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

122 Commits

Folders and files

Repository files navigation

MōDevice — a peripherals configuration demo

MōDevice is a small reference application for configuring mice and keyboards, built with MōBrowser. It shows how a React interface communicates with a TypeScript main process that owns the device model, and a native C++ module that drives real keyboards and mice over HID.

Device overview on Windows

What the demo shows

  • Discover and manage QMK/VIA keyboards and Logitech mice, plus Razer keyboards and mice on Windows.
  • Configure keyboard mappings and lighting, mouse buttons and movement, and Razer static lighting.
  • Show live connection, firmware, and battery information while keeping devices and settings between launches.

Device overview on macOS Mouse button configuration

Keyboard lighting configuration App settings

Razer controls are Windows-only and use the Razer Chroma SDK. The Mamba Wireless and Huntsman ENG have model-specific artwork; other detected Razer keyboards and mice use generic artwork with the same static lighting controls. The demo requires no account or API key. Device data and settings stay local; packaged builds contact GitHub Releases only to check for updates.

Requirements

  • macOS 14 or later on Apple silicon, Windows 10 or later on x64, or Linux on x64. See Supported platforms.
  • Node.js 20.20.2, 22.22.2, or 24.14.1 and later.
  • MōBrowser 2.18.0 or later.
  • For Razer devices on Windows: Razer Synapse with its Chroma Connect module, which installs the Chroma SDK runtime (RzChromaSDK64.dll) and its service. Without it, Razer devices are not listed. Chroma apps must be allowed in Synapse.

Run from source

npm install
npm run dev

To create a production build:

npm run build

For a Mamba Wireless (2018), discovery checks whether the USB receiver has a responding mouse. An idle receiver is excluded, including when the mouse is connected by cable. Separate active mice remain separate devices. If the query fails or another app interrupts it, discovery keeps the last confirmed state until a later scan succeeds. Other Razer models still use USB enumeration.

Project structure

  • src/main/device-state.ts owns the device list and settings: pairing, validation, and the keyboards and mice the native module reports.
  • src/main/via.ts maps VIA hardware to app devices: known models, effects, and value ranges.
  • src/main/logitech.ts maps Logitech mice to app devices.
  • src/main/razer.ts maps Razer keyboards and mice to app devices.
  • src/main/devices.ts connects the device state to the interface, the native module, and saved preferences.
  • src/native/hardware_service.* serves the open keyboards and mice to the main process over native RPC.
  • src/native/via_keyboard.* speaks the VIA protocol over HIDAPI.
  • src/native/hidpp_mouse.* speaks Logitech's HID++ 2.0 protocol over HIDAPI.
  • src/native/chroma_device.* finds Razer keyboards and mice over HIDAPI; the Chroma SDK lights them.
  • src/native/platform/ holds everything that differs per operating system: platform.h and one implementation file per supported platform.
  • src/renderer/gateway/devices.ts is the interface's single entry point for device operations.
  • src/renderer/components/device/ contains the shared device screen and the separate mouse and keyboard editors.
  • src/renderer/public/device-art/ contains the product images shown in the app.

Supported platforms

Platform Support
macOS 14+ Apple silicon
Windows 10+ x64, including Razer Chroma
Linux x64; device access requires the included udev rule

Connect real devices

The main process owns the app's device model; native code is a thin hardware adapter. Keep the native contract coarse: one call lists the complete hardware state, one applies a complete setting, and a callback sends a complete snapshot whenever hardware comes or goes. Do not expose one RPC per SDK or HID command. See src/native/proto/devices.proto.

The demo saves the added devices and their last known settings in src/main/devices.ts, to show them while they are disconnected. Settings are always read from the hardware when a device connects, never restored onto it. Razer devices are the exception: the Chroma SDK cannot read them, so the native module reports the color it last wrote, or a default.

Add a device

Another model of a supported kind (a VIA keyboard, a mouse behind a Bolt receiver, or a Razer keyboard or mouse) needs no native changes:

  • For a VIA keyboard, add its vendor and product IDs and effect numbers to KNOWN_MODELS in src/main/via.ts. Without an entry it still works with Steady only.
  • A Razer keyboard or mouse is found by its USB vendor ID and lit through the Chroma SDK as is.
  • Optionally, add its artwork to src/renderer/public/device-art/ and connect its modelId in device-art.tsx. Without it, the device shows the default artwork for its kind.
  • On Linux, add a line for a new vendor ID to 70-modevice.rules.

A new device protocol requires changes to the native driver, IPC contracts, main-process mapping, and renderer. Run npm run gen after changing a .proto file.

Download

You can download the app from the releases page. macOS releases are code-signed and notarized by Apple; Windows releases are code-signed.

License

MIT — see LICENSE.

About

A reference application for configuring mice and keyboards.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages