Add a cosmic-idle-config crate for settings

This commit is contained in:
Ian Douglas Scott 2024-10-15 09:46:03 -07:00
parent f30c7c3172
commit 92a5219eb9
4 changed files with 1196 additions and 15 deletions

1173
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -9,3 +9,10 @@ rustix = { version = "0.38.34", features = ["fs"] }
wayland-client = "0.31.5"
wayland-protocols = { version = "0.32.3", features = ["client", "staging"] }
wayland-protocols-wlr = { version = "0.3.3", features = ["client"] }
cosmic-config = { git = "https://github.com/pop-os/libcosmic" }
cosmic-idle-config = { path = "./cosmic-idle-config" }
[workspace]
members = [
"cosmic-idle-config"
]

View file

@ -0,0 +1,8 @@
[package]
name = "cosmic-idle-config"
version = "0.1.0"
edition = "2021"
[dependencies]
cosmic-config = { git = "https://github.com/pop-os/libcosmic" }
serde = { version = "1.0.210", features = ["derive"] }

View file

@ -0,0 +1,23 @@
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,
}
impl Default for CosmicIdleConfig {
fn default() -> Self {
Self {
time: 60 * 10,
action: IdleAction::ScreenOff,
}
}
}