rainmeter

Crates.iorainmeter
lib.rsrainmeter
version0.1.1
created_at2025-07-18 16:31:05.71417+00
updated_at2025-11-04 06:36:51.16615+00
descriptionA safe, high-level Rust wrapper around Rainmeter's C/C++ plugin API.
homepagehttps://github.com/KitsuneDev/rainmeter-rs
repositoryhttps://github.com/KitsuneDev/rainmeter-rs
max_upload_size
id1759165
size73,048
Kitsune (KitsuneDev)

documentation

README

rainmeter

Rainmeter Rust Plugin Interface

A (probably)-safe, high-level Rust wrapper around RainmeterΓÇÖs C/C++ plugin API. (I don't write too much Rust, so this is a work in progress. Don't judge me too harshly, please!)

Please note this is platform-specific to Windows, as Rainmeter is a Windows-only application.

For more information, please refer to the Rainmeter C++ API Overview (for the implementable functions) and the Rainmeter C++ API Reference (Which is accessed via the RainmeterContext arguments).

Features

  • Write your Rainmeter plugins in idiomatic Rust, with traits!!
  • Ergonomic Rust methods for reading measure options (ReadString, ReadFormula, etc.)
  • Typed getters for skin data (measure name, skin path, HWND, etc.)
  • Safe logging and panic-handling in your plugin entry points
  • Simple RainmeterPlugin trait and declare_plugin! macro to expose plugins

Installation

Add this crate to your Cargo.toml:

[dependencies]
rainmeter = "0.1"

[lib]
crate-type = ["cdylib"]

Usage

use rainmeter::{RainmeterContext, RainmeterPlugin, RmLogLevel, declare_plugin};

#[derive(Default)]
struct MyPlugin;

impl RainmeterPlugin for MyPlugin {
    fn initialize(&mut self, rm: RainmeterContext) {
        let val = rm.read_double("Value", 1.0);
        rm.log(RmLogLevel::LogNotice, &format!("Value = {}", val));
    }

    fn reload(&mut self, rm: RainmeterContext, _max: &mut f64) {}
    fn update(&mut self, _rm: RainmeterContext) -> f64 { 0.0 }
    fn finalize(&mut self, _rm: RainmeterContext) {}
    fn get_string(&mut self, _rm: RainmeterContext) -> Option<String> { // Optional
        None
    }
    fn execute_bang(&mut self, _rm: RainmeterContext, _args: &str) {} // Optional
}

declare_plugin!(crate::MyPlugin);

License: LGPL-3.0-or-later

Commit count: 0

cargo fmt