pub trait Timer {
// Required method
fn time_left(&mut self, idle_time: Duration) -> Result<Option<Duration>>;
// Provided methods
fn abort_urgency(&self) -> Option<Duration> { ... }
fn activate(&mut self) -> Result<()> { ... }
fn abort(&mut self) -> Result<()> { ... }
fn deactivate(&mut self) -> Result<()> { ... }
fn disabled(&mut self) -> bool { ... }
}Expand description
The timer trait is used to tell xidlehook after how much idle time your timer should activate (relatively), and what activation actually means. It also provides you with the ability to implement what happens when the next timer is activated, and also to disable the timer.
Required Methods§
Provided Methods§
Sourcefn abort_urgency(&self) -> Option<Duration>
fn abort_urgency(&self) -> Option<Duration>
How urgent this timer wants to be notified on abort (when the user is no longer idle).
Return as slow of a duration as you think is acceptable to be nice to the CPU - preferrably
return None which basically means infinity.
Sourcefn abort(&mut self) -> Result<()>
fn abort(&mut self) -> Result<()>
Called when the timer was aborted early - such as when the user moves their mouse or otherwise stops being idle.
Sourcefn deactivate(&mut self) -> Result<()>
fn deactivate(&mut self) -> Result<()>
Called when another timer was activated after this one