Skip to content

Latest commit

Β 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⌨️ RustKeyboard β€” MSI Keyboard RGB LED Controller

image

Rust Windows MSI License

A lightweight, native RGB LED controller for MSI-based gaming laptops Built with Rust + Native Windows Win32 API β€” no bloated software needed.

Features β€’ Screenshots β€’ Installation β€’ Compatibility β€’ Building β€’ Hotkey β€’ FAQ


🎯 The Problem

MSI gaming laptops (and MSI-based OEM brands like Game Garaj) ship with keyboard RGB backlighting, but:

  • ❌ MSI Center / SteelSeries GG is bloated, uses 300+ MB RAM, and often fails to detect the keyboard
  • ❌ The default lighting software doesn't support OEM/rebranded MSI laptops (Game Garaj, XPG, etc.)
  • ❌ Keyboards sometimes get stuck in bootloader mode after sleep/hibernate β€” LEDs stop working entirely
  • ❌ No simple way to quickly toggle lighting modes without opening a full application

βœ… The Solution

RustKeyboard is a tiny (~11 MB), zero-dependency native app that:

  • 🎨 Directly controls your keyboard LEDs via USB HID β€” no MSI Center needed
  • πŸ”§ Automatically recovers keyboards stuck in bootloader mode (Artery MCU)
  • ⌨️ Fn+F8 hotkey to cycle through hardware lighting modes instantly
  • πŸ–₯️ Runs silently in the system tray with 0% CPU usage when minimized
  • 🌍 Supports English, German (Deutsch), and Turkish (TΓΌrkΓ§e) interfaces

✨ Features

πŸ”΄πŸŸ’πŸ”΅ Hardware Lighting Modes

Mode Description
Off All LEDs disabled
Static Single Color Solid color across all zones
Breathing Wave Smooth fade in/out
Single Flashing Single blink pattern
Double Flashing Double blink pattern
Multi-color Shift Colors shift across zones
Rainbow Full RGB spectrum sweep

πŸ› οΈ Other Features

  • 7-zone color customization β€” pick any color for each keyboard zone
  • System tray β€” minimize to tray, runs in background with 0% CPU usage
  • Start on boot β€” optional Windows auto-start via Registry
  • Bootloader recovery β€” auto-detect and wake up stuck keyboards
  • Fn+F8 hotkey β€” cycle through all 7 hardware modes with a single keypress
  • Multi-language UI β€” English πŸ‡¬πŸ‡§, Deutsch πŸ‡©πŸ‡ͺ, TΓΌrkΓ§e πŸ‡ΉπŸ‡·

πŸ–₯️ Compatibility

Developed & Tested On

Component Details
Laptop Game Garaj Slayer XL (MSI OEM)
Motherboard MSI MS-17L2
BIOS E17L2IE2.103 (2021-07-22)
CPU Intel Core i7-11800H @ 2.30GHz (11th Gen Tiger Lake)
GPU NVIDIA GeForce RTX 3050 Ti Laptop + Intel UHD Graphics
RAM 40 GB DDR4
OS Windows 11 Pro
Keyboard MCU Artery AT32 (VID: 0x2E3C, Bootloader PID: 0xAF01)

Compatible MSI Keyboard Models

This tool communicates with MSI keyboards via USB HID using:

  • Vendor ID: 0x1462 (Micro-Star International)
  • Product IDs: 5474, 5475, 5476

It should work with any MSI laptop keyboard that uses these HID identifiers, including:

Brand Series Notes
MSI GE, GF, GP, GS, GT series Steelseries per-key RGB keyboards
Game Garaj Slayer series Turkish MSI OEM brand
XPG / ADATA Xenia series Some MSI-based models

Note

If your MSI laptop's keyboard uses different PIDs, you can check with a USB HID tool and open an issue to add support.


πŸ“¦ Installation

Pre-built Binary

  1. Download rustkeyboard.exe from the Releases page
  2. Place it in C:\rustkeyboard\ (or any folder)
  3. Run rustkeyboard.exe
  4. (Optional) Enable "Start on Boot" in the Options panel

From Source

See Building from Source below.


⌨️ Hotkey

Key Action
Fn + F8 Cycle through hardware lighting modes: Off β†’ Static β†’ Breathing β†’ Single Flash β†’ Double Flash β†’ Multi-color β†’ Rainbow β†’ Off β†’ ...

Tip

The hotkey works globally β€” even when the app is minimized to the system tray. It saves the new mode to config automatically.


πŸ—οΈ Building from Source

Prerequisites

  • Rust (2024 edition)
  • Windows 10/11 (x86_64)

Build

git clone https://github.com/mahirgul/rustkeyboard.git
cd rustkeyboard
cargo build --release

The compiled binary will be at target\release\rustkeyboard.exe.

Deploy

# Using the included deploy script:
deploy.bat

This builds in release mode and copies the exe to the project root.


πŸ“ Project Structure

rustkeyboard/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.rs          # Entry point, registers window class and starts loops
β”‚   β”œβ”€β”€ window.rs        # Native Win32 window (controls, custom drawing, events)
β”‚   β”œβ”€β”€ i18n.rs          # Localization (EN/DE/TR translations)
β”‚   β”œβ”€β”€ hid.rs           # USB HID communication with MSI keyboards
β”‚   β”œβ”€β”€ hook.rs          # Global keyboard hook (Fn+F8 mode cycling)
β”‚   β”œβ”€β”€ tray.rs          # Windows system tray icon + context menu
β”‚   β”œβ”€β”€ config.rs        # JSON config persistence
β”‚   β”œβ”€β”€ startup.rs       # Windows Registry auto-start management
β”‚   └── globals.rs       # Cross-thread shared state (atomics/mutexes)
β”œβ”€β”€ config.json          # User configuration (auto-generated)
β”œβ”€β”€ icon.ico             # System tray icon
β”œβ”€β”€ wresources.rc        # Windows resource file (icon embedding)
β”œβ”€β”€ build.rs             # Build script (embed-resource)
β”œβ”€β”€ deploy.bat           # Build & deploy helper
β”œβ”€β”€ Cargo.toml           # Rust dependencies
└── README.md            # This file

πŸ”§ Configuration

Settings are stored in config.json next to the executable:

{
  "mode": 6,
  "speed": 2,
  "brightness": 10,
  "colors": [[255,255,255], [255,0,0], [255,165,0], [255,255,0], [0,255,0], [0,255,255], [255,0,255]],
  "close_to_tray": true,
  "start_in_tray": true,
  "language": "en"
}
Field Type Description
mode 0-6 Hardware effect mode
speed 0-2 Hardware effect speed (Slow/Medium/Fast) [config-only]
brightness 0-10 LED brightness level [config-only]
colors [R,G,B]Γ—7 7 RGB color zones
close_to_tray bool Minimize to tray instead of closing
start_in_tray bool Start minimized to system tray [config-only]
language "en"/"de"/"tr" UI language

❓ FAQ

Q: My keyboard LEDs stopped working after sleep/hibernate!

Click "⚑ Force Wake Up" in the Actions panel. The app will send a recovery command to the Artery bootloader MCU.

Q: The app says "Not Found" for keyboard status.

Make sure no other software (MSI Center, SteelSeries GG) is holding the HID device open. Close them and click "πŸ”„ Refresh".

Q: Does this work with per-key RGB?

Currently this controls keyboard-wide (zone-based) lighting, not individual per-key colors. Per-key support may be added in the future.

Q: Can I add my own MSI keyboard PID?

Yes! Open src/hid.rs and add your PID to the MSI_PIDS array. You can find your keyboard's PID using USBDeview or Device Manager.

Q: How does the background CPU usage remain at 0%?

The application is built entirely using the native Win32 API, eliminating GUI framework overhead. When minimized to the system tray, the window is hidden (SW_HIDE), and standard Win32 message loop processing handles the system tray events, guaranteeing 0% CPU consumption.


πŸ“‹ Dependencies

Crate Version Purpose
hidapi 2.6.2 USB HID communication
serde + serde_json 1.0 JSON config serialization
windows-sys 0.52.0 Win32 API (hooks, tray, window management)
rand 0.9 Randomness
embed-resource 2.5 Build-time icon embedding

πŸ“„ License

This project is licensed under the MIT License.


Made with ❀️ and πŸ¦€ Rust

If this tool helped you, please ⭐ star the repo!

About

πŸ¦€ A lightweight (~2MB RAM) MSI Laptop Keyboard RGB LED controller written in Rust. Features 7-zone color customization, global Fn+F8 hotkey cycling, and sleep mode automatic recovery. Zero-dependency alternative to MSI Center.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages