#print!("something ") rust tauri not working
9 messages · Page 1 of 1 (latest)
Could you publish your code. Also can you try using the println! macro?
Where are you looking for the output? It should output to the terminal where you run the app. And when do you run it? Send code
`use tauri::Manager;
use tauri::{CustomMenuItem, SystemTray, SystemTrayEvent, SystemTrayMenu};
fn main() {
let tray_menu = SystemTrayMenu::new(); // insert the menu items here
tauri::Builder::default()
.system_tray(SystemTray::new().with_menu(tray_menu))
.on_system_tray_event(|app, event| match event {
SystemTrayEvent::LeftClick {
position: _,
size: _,
..
} => {
println!("system tray received a left click");
}
SystemTrayEvent::RightClick {
position: _,
size: _,
..
} => {
println!("system tray received a right click");
}
SystemTrayEvent::DoubleClick {
position: _,
size: _,
..
} => {
println!("system tray received a double click");
}
SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() {
"quit" => {
std::process::exit(0);
}
"hide" => {
let window = app.get_window("main").unwrap();
window.hide().unwrap();
}
_ => {}
},
_ => {}
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
`
This is my code (example system tray) but I also tried other ones I am getting no output. I run it with npm run tauri dev and I am looking for the output in the same console.
Last output of the terminal but its still running:
warning: test (bin "test") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 14.10s
(test:6447): LIBDBUSMENU-GLIB-WARNING **: 18:37:32.395: About to Show called on an item wihtout submenus. We're ignoring it.
I also don't thinks its something with the code. Is there a setting to enable/disable the output in the rust console?