23 lines
473 B
Rust
23 lines
473 B
Rust
use pyo3::prelude::*;
|
|
use std::process::Command;
|
|
|
|
#[pyfunction]
|
|
fn send_notification(icon_path: &str, nick: &str, text: &str) -> PyResult<()> {
|
|
Command::new("notify-send")
|
|
.arg("-i")
|
|
.arg(icon_path)
|
|
.arg("--")
|
|
.arg(format!("{}:", nick))
|
|
.arg(text)
|
|
.spawn()?;
|
|
|
|
Ok(())
|
|
}
|
|
|
|
#[pymodule]
|
|
fn wn_backend(_py: Python, m: &PyModule) -> PyResult<()> {
|
|
m.add_function(wrap_pyfunction!(send_notification, m)?)?;
|
|
|
|
Ok(())
|
|
}
|