unsure
This commit is contained in:
parent
0e3233009b
commit
1a00daf6a8
11 changed files with 1192 additions and 67 deletions
|
|
@ -12,8 +12,12 @@ pub struct Config {
|
|||
#[serde(default)]
|
||||
pub lua: LuaConfig,
|
||||
#[serde(default)]
|
||||
pub modules: ModulesConfig,
|
||||
#[serde(default)]
|
||||
pub adapters: AdaptersConfig,
|
||||
#[serde(default)]
|
||||
pub notifications: NotificationsConfig,
|
||||
#[serde(default)]
|
||||
pub events: EventsConfig,
|
||||
}
|
||||
|
||||
|
|
@ -33,6 +37,14 @@ pub struct LuaConfig {
|
|||
pub module_path: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct ModulesConfig {
|
||||
#[serde(default = "default_true")]
|
||||
pub builtin: bool,
|
||||
#[serde(default)]
|
||||
pub disable: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct AdaptersConfig {
|
||||
#[serde(default)]
|
||||
|
|
@ -73,12 +85,24 @@ pub struct EventsConfig {
|
|||
pub dedup_window_ms: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct NotificationsConfig {
|
||||
#[serde(default = "default_notify_timeout")]
|
||||
pub default_timeout_ms: i64,
|
||||
#[serde(default = "default_notify_urgency")]
|
||||
pub default_urgency: String,
|
||||
#[serde(default = "default_notify_path")]
|
||||
pub notify_send_path: String,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
daemon: DaemonConfig::default(),
|
||||
lua: LuaConfig::default(),
|
||||
modules: ModulesConfig::default(),
|
||||
adapters: AdaptersConfig::default(),
|
||||
notifications: NotificationsConfig::default(),
|
||||
events: EventsConfig::default(),
|
||||
}
|
||||
}
|
||||
|
|
@ -102,6 +126,15 @@ impl Default for LuaConfig {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for ModulesConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
builtin: default_true(),
|
||||
disable: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for AdaptersConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
|
|
@ -147,6 +180,16 @@ impl Default for EventsConfig {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for NotificationsConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
default_timeout_ms: default_notify_timeout(),
|
||||
default_urgency: default_notify_urgency(),
|
||||
notify_send_path: default_notify_path(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn load() -> Result<Self> {
|
||||
let path = config_path();
|
||||
|
|
@ -218,6 +261,18 @@ fn default_dedup_window() -> u64 {
|
|||
100
|
||||
}
|
||||
|
||||
fn default_notify_timeout() -> i64 {
|
||||
3000
|
||||
}
|
||||
|
||||
fn default_notify_urgency() -> String {
|
||||
"normal".to_string()
|
||||
}
|
||||
|
||||
fn default_notify_path() -> String {
|
||||
"notify-send".to_string()
|
||||
}
|
||||
|
||||
fn default_udev_subsystems() -> Vec<String> {
|
||||
vec![
|
||||
"usb".to_string(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue