Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
hhstore committed Mar 27, 2024
1 parent 7fd7972 commit acdf24e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
12 changes: 12 additions & 0 deletions crates/rs-os/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# rs-os

- OS 操作系统 API 相关的库 & 使用示例.

## rs-cross:

- 跨平台相关的库

### libs:

- [try-notify](./rs-cross/try-notify): 系统通知(macOS/Windows/Linux)
- 基于: https://github.com/hoodie/notify-rust
22 changes: 21 additions & 1 deletion crates/rs-os/rs-cross/try-notify/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
#[cfg(target_os = "macos")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
use notify_rust::Notification;

Notification::new()
.summary("Safari Crashed")
.body("Just kidding, this is just the notify_rust example.")
.appname("Toastify")
.icon("Toastify")
.show()?;

Ok(())
}

#[cfg(all(unix, not(target_os = "macos")))]
fn main() {
println!("this is a mac only feature")
}

#[cfg(target_os = "windows")]
fn main() {
println!("Hello, world!");
println!("this is a mac only feature")
}

0 comments on commit acdf24e

Please sign in to comment.