wpush

Crates.iowpush
lib.rswpush
version0.1.1
sourcesrc
created_at2023-08-28 02:31:09.223985
updated_at2023-09-03 23:07:58.849973
descriptionWPush is a Rust library that makes sending Windows toasts easier. Includes WSL support!
homepage
repositoryhttps://github.com/saez-juan/wpush.rs
max_upload_size
id956546
size31,415
Juan Saez (saez-juan)

documentation

README

wpush.rs

github crates.io docs.rs

Toast Notification on Windows

This crate provides an easy way to send toast notification on Windows. It is heavily inspired on the Go package go-toast/toast.

Also, this library includes WSL support, that means, if you compile and run from WSL, the toast should appear. However, this approach may be limited because, internally, the toast feature on Windows needs to access to regedit, which causes some issues to get the APP_ID.

Go to full crate documentation.

Usage

Add this to your cargo.toml:

[dependencies]
wpush = "0.1.1"

On your main.rs you could do something like this:

use wpush::Notification;

fn main() {
    let mut n = Notification::new();

    n.set_title(Some("WPush Library"));
    n.set_message(Some("This toast was sent from Rust!"));

    n.push();
}

Notification Setup

The Notification has some setters that can be used before pushing.

let mut n = Notification::new();

n.set_app_id(&str);           // The APP_ID is required.
                              // Default: "Windows App"
n.set_title(Option<&str>);
n.set_message(Option<&str>);
n.set_icon(Option<&str>);    // Must be a path to the image file
n.set_audio(Option<Audio>);  // Audio is a wpush enum.

n.push();

Some setters are missing. They are going to be added on next versions.

Licence

This library is under Mozilla Public Licence Version 2.0


Made by Juan Saez

Commit count: 8

cargo fmt