mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
source code
This commit is contained in:
43
libs/systray-rs/examples/systray-example.rs
Normal file
43
libs/systray-rs/examples/systray-example.rs
Normal file
@@ -0,0 +1,43 @@
|
||||
#![windows_subsystem = "windows"]
|
||||
|
||||
//#[cfg(target_os = "windows")]
|
||||
fn main() -> Result<(), systray::Error> {
|
||||
let mut app;
|
||||
match systray::Application::new() {
|
||||
Ok(w) => app = w,
|
||||
Err(_) => panic!("Can't create window!"),
|
||||
}
|
||||
// w.set_icon_from_file(&"C:\\Users\\qdot\\code\\git-projects\\systray-rs\\resources\\rust.ico".to_string());
|
||||
// w.set_tooltip(&"Whatever".to_string());
|
||||
app.set_icon_from_file("/usr/share/gxkb/flags/ua.png")?;
|
||||
|
||||
app.add_menu_item("Print a thing", |_| {
|
||||
println!("Printing a thing!");
|
||||
Ok::<_, systray::Error>(())
|
||||
})?;
|
||||
|
||||
app.add_menu_item("Add Menu Item", |window| {
|
||||
window.add_menu_item("Interior item", |_| {
|
||||
println!("what");
|
||||
Ok::<_, systray::Error>(())
|
||||
})?;
|
||||
window.add_menu_separator()?;
|
||||
Ok::<_, systray::Error>(())
|
||||
})?;
|
||||
|
||||
app.add_menu_separator()?;
|
||||
|
||||
app.add_menu_item("Quit", |window| {
|
||||
window.quit();
|
||||
Ok::<_, systray::Error>(())
|
||||
})?;
|
||||
|
||||
println!("Waiting on message!");
|
||||
app.wait_for_message()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// #[cfg(not(target_os = "windows"))]
|
||||
// fn main() {
|
||||
// panic!("Not implemented on this platform!");
|
||||
// }
|
||||
Reference in New Issue
Block a user