MCPcopy Index your code
hub / github.com/OpenActionAPI/rust-elgato-streamdeck

github.com/OpenActionAPI/rust-elgato-streamdeck @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
99 symbols 193 edges 7 files 76 documented · 77%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

elgato-streamdeck

Rust library for interacting with Elgato Stream Deck hardware. Heavily based on python-elgato-streamdeck and partially on rust-streamdeck.

This library was made by @TheJebForge as a better-designed alternative to rust-streamdeck, taking code from both of the libraries and making it more pleasant to use.

udev rules for Linux

If you're using systemd on your system, you might have to install udev rules to allow connecting to devices from userspace.

You can do that by using the following command to copy this repo's included 40-streamdeck.rules file into udev/rules.d/:

cp 40-streamdeck.rules /etc/udev/rules.d/

And then reloading udev rules:

sudo udevadm control --reload-rules

Unplugging and plugging back in the device should also help.

You should also create a group called "plugdev" if it doesn't exist and add yourself to it, so you get access to the devices. You also need to restart the user session to let user group changes to kick in.

Example

use elgato_streamdeck::{new_hidapi, StreamDeck};

// Create instance of HidApi
let hid = new_hidapi();

// List devices and unsafely take first one
let (kind, serial) = StreamDeck::list_devices(&hid).remove(0);

// Connect to the device
let mut device = StreamDeck::connect(&hid, kind, &serial)
    .expect("Failed to connect");

// Print out some info from the device
println!(
    "Connected to '{}' with version '{}'",
    device.serial_number().unwrap(),
    device.firmware_version().unwrap()
);

// Set device brightness
device.set_brightness(35).unwrap();

// Use image-rs to load an image
let image = image::open("no-place-like-localhost.jpg").unwrap();

// Write it to the device
device.set_button_image(7, image).unwrap();

// Flush
if device.updated {
    device.flush().unwrap();
}

Status

  • [x] Convenient to use API for looking up devices, connecting to them and interacting with them
  • [x] Reading buttons with async

Supported Devices

As it stands, this library should support the following devices. - Stream Deck Original - Stream Deck Original V2 - Stream Deck XL - Stream Deck XL V2 - Stream Deck Mini - Stream Deck Mini Mk2 - Stream Deck Mini Discord Edition - Stream Deck Mk2 - Stream Deck Pedal - Stream Deck Plus (thanks to node-elgato-stream-deck) - Stream Deck Plus XL (thanks to @Jerry260102) - Stream Deck Neo (thanks to @ejiektpobehuk, @AkechiShiro and node-elgato-stream-deck)

Support for non-Elgato (Mirabox/Ajazz) devices has been removed in v0.11. If you wish to use these devices, please use the mirajazz crate, or use v0.10.2 of this crate.

Core symbols most depended-on inside this repo

key_count
called by 16
src/info.rs
kind
called by 12
src/lib.rs
lcd_image_format
called by 8
src/info.rs
convert_image_with_format
called by 6
src/images.rs
get_feature_report
called by 6
src/util.rs
extract_str
called by 6
src/util.rs
read
called by 5
src/lib.rs
send_feature_report
called by 5
src/util.rs

Shape

Method 62
Function 21
Class 9
Enum 7

Languages

Rust100%

Modules by API surface

src/lib.rs36 symbols
src/asynchronous.rs24 symbols
src/info.rs21 symbols
src/util.rs9 symbols
src/images.rs7 symbols
examples/simple.rs1 symbols
examples/async.rs1 symbols

For agents

$ claude mcp add rust-elgato-streamdeck \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact