Monitor config as calloop source; use for screen_off_time

Still not sure best way to configure multiple idle times.
This commit is contained in:
Ian Douglas Scott 2024-10-17 18:51:29 -07:00
parent 6d15d0f3c9
commit f2c83714c0
4 changed files with 112 additions and 61 deletions

View file

@ -1,23 +1,16 @@
use cosmic_config::{cosmic_config_derive::CosmicConfigEntry, CosmicConfigEntry};
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
pub enum IdleAction {
ScreenOff,
Command(Vec<String>),
}
#[derive(Debug, Deserialize, Serialize, Clone, CosmicConfigEntry)]
pub struct CosmicIdleConfig {
pub time: u32,
pub action: IdleAction,
/// Screen off idle time, in ms
pub screen_off_time: u32,
}
impl Default for CosmicIdleConfig {
fn default() -> Self {
Self {
time: 60 * 10,
action: IdleAction::ScreenOff,
screen_off_time: 10 * 60 * 1000,
}
}
}