chore: update todo list, add imports
- use std::time::{Duration, Instant} for convenience
This commit is contained in:
parent
46af703f1d
commit
42c3278f82
|
@ -43,6 +43,7 @@ To build, you must have [Rust](https://www.rust-lang.org/) and
|
|||
- [ ] Force update devices button in tray menu
|
||||
- [ ] Colored tray icons for different battery levels
|
||||
- [x] Show log window button in tray menu
|
||||
- [ ] Further reduce CPU usage by using Event Loop Proxy events (more info [here](https://github.com/tauri-apps/tray-icon/issues/83#issuecomment-1697773065))
|
||||
- [ ] Prebuilt Binary
|
||||
- [ ] Command Line Arguments for update frequency
|
||||
- [ ] Support for other Razer Devices (I only have DeathAdder V3 Pro, so I won't be able to test it with other devices)
|
||||
|
|
10
src/tray.rs
10
src/tray.rs
|
@ -3,7 +3,7 @@ use std::{
|
|||
rc::Rc,
|
||||
sync::{mpsc, Arc, Mutex},
|
||||
thread,
|
||||
time::Duration,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use crate::manager::DeviceManager;
|
||||
|
@ -18,8 +18,8 @@ use winapi::um::{
|
|||
winuser::{self, ShowWindow},
|
||||
};
|
||||
|
||||
const BATTERY_UPDATE_INTERVAL: std::time::Duration = std::time::Duration::from_secs(60);
|
||||
const DEVICE_FETCH_INTERVAL: std::time::Duration = std::time::Duration::from_secs(5);
|
||||
const BATTERY_UPDATE_INTERVAL: Duration = Duration::from_secs(60);
|
||||
const DEVICE_FETCH_INTERVAL: Duration = Duration::from_secs(5);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct MemoryDevice {
|
||||
|
@ -194,7 +194,7 @@ impl TrayApp {
|
|||
|
||||
let menu_channel = MenuEvent::receiver();
|
||||
|
||||
let mut last_update = std::time::Instant::now();
|
||||
let mut last_update = Instant::now();
|
||||
let update_interval = Duration::from_millis(100);
|
||||
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
|
@ -237,7 +237,7 @@ impl TrayApp {
|
|||
}
|
||||
}
|
||||
|
||||
last_update = std::time::Instant::now();
|
||||
last_update = Instant::now();
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
|
|
Loading…
Reference in New Issue