This commit is contained in:
@@ -10,31 +10,28 @@ pub fn _build() -> gtk::Box {
|
|||||||
let host = TrayHost::new();
|
let host = TrayHost::new();
|
||||||
|
|
||||||
if let Ok(mut host) = host {
|
if let Ok(mut host) = host {
|
||||||
glib::timeout_add_local(
|
glib::timeout_add_local(Duration::from_millis(1_000), move || {
|
||||||
Duration::from_millis(1_000),
|
for event in host.poll().unwrap() {
|
||||||
move || {
|
match event {
|
||||||
for event in host.poll().unwrap() {
|
TrayEvent::ItemAdded(id) | TrayEvent::ItemChanged(id) => {
|
||||||
match event {
|
if let Some(item) = host.items().get(&id) {
|
||||||
TrayEvent::ItemAdded(id) | TrayEvent::ItemChanged(id) => {
|
println!("tray: {} — {}", item.title, item.status);
|
||||||
if let Some(item) = host.items().get(&id) {
|
println!(" category: {}", item.category);
|
||||||
println!("tray: {} — {}", item.title, item.status);
|
println!(" has menu: {}", item.has_menu());
|
||||||
println!(" category: {}", item.category);
|
|
||||||
println!(" has menu: {}", item.has_menu());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
TrayEvent::ItemRemoved(id) => {
|
|
||||||
println!("item gone: {id}");
|
|
||||||
}
|
|
||||||
TrayEvent::HostShutdown => break,
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
|
TrayEvent::ItemRemoved(id) => {
|
||||||
|
println!("item gone: {id}");
|
||||||
|
}
|
||||||
|
TrayEvent::HostShutdown => break,
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
ControlFlow::Continue
|
|
||||||
}
|
}
|
||||||
);
|
ControlFlow::Continue
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
error!(&LOGGER, "Couldn't get SystemTray");
|
error!(&LOGGER, "Couldn't get SystemTray");
|
||||||
}
|
}
|
||||||
|
|
||||||
systray
|
systray
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user