step 6+7: live clock, CPU/MEM/power/battery/WiFi stats poller
This commit is contained in:
parent
241e3bc2cb
commit
f1b471652b
3 changed files with 163 additions and 7 deletions
|
|
@ -1 +1,16 @@
|
|||
use crate::{App, AppInput};
|
||||
use relm4::ComponentSender;
|
||||
|
||||
pub fn current() -> String {
|
||||
let dt = gtk4::glib::DateTime::now_local().expect("local time");
|
||||
format!("{:02}:{:02}", dt.hour(), dt.minute())
|
||||
}
|
||||
|
||||
pub fn spawn_ticker(sender: ComponentSender<App>) {
|
||||
relm4::spawn(async move {
|
||||
loop {
|
||||
sender.input(AppInput::ClockTick);
|
||||
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue