diff --git a/MANUAL.md b/MANUAL.md index cc2ae35c..371da285 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -117,60 +117,67 @@ I'm unsure of how many laptops this works on, so please try it. An Aura config itself is a file with contents: -```json -{ - "name": "aura-default", - "aura": [ - { - "Breathe": { - "led_type": { - "Key": "W" - }, - "start_colour1": [ - 255, - 0, - 20 +```ron +( + name: "aura-default", + aura: ( + effects: [ + Breathe(( + led: W, + start_colour1: (255, 0, 20), + start_colour2: (20, 255, 0), + speed: Low, + )), + Breathe(( + led: A, + start_colour1: (255, 0, 20), + start_colour2: (20, 255, 0), + speed: Low, + )), + Breathe(( + led: S, + start_colour1: (255, 0, 20), + start_colour2: (20, 255, 0), + speed: Low, + )), + Breathe(( + led: D, + start_colour1: (255, 0, 20), + start_colour2: (20, 255, 0), + speed: Low, + )), + Breathe(( + led: F, + start_colour1: (255, 0, 0), + start_colour2: (255, 0, 0), + speed: High, + )), + Static(( + led: RCtrl, + colour: (0, 0, 255), + )), + Static(( + led: LCtrl, + colour: (0, 0, 255), + )), + Static(( + led: Esc, + colour: (0, 0, 255), + )), + DoomFlicker(( + led: N9, + start_colour: (0, 0, 255), + max_percentage: 80, + min_percentage: 40, + )), ], - "start_colour2": [ - 20, - 255, - 0 - ], - "speed": "Low" - } - }, - { - "Static": { - "led_type": { - "Key": "Esc" - }, - "colour": [ - 0, - 0, - 255 - ] - } - }, - { - "Flicker": { - "led_type": { - "Key": "N9" - }, - "start_colour": [ - 0, - 0, - 255 - ], - "max_percentage": 80, - "min_percentage": 40 - } - } - ] -} + zoned: false, + ), +) ``` -If your laptop supports multizone, `"led_type"` can also be `"Zone": ` -- `"None"` +If your laptop supports multizone, `"led"` can also be `"Zone": ` +- `SingleZone` // Keyboards with only one zone - `ZonedKbLeft` // keyboard left - `ZonedKbLeftMid` // keyboard left-middle - `ZonedKbRightMid` // etc @@ -182,6 +189,25 @@ If your laptop supports multizone, `"led_type"` can also be `"Zone": = tmp.split('.').collect(); + cfg_old.push(format!("{}.cfg", parts[0])); + } + if do_rename && cfg_old.exists() { + // Now we gotta rename it + warn!("Renaming {cfg_old:?} to {config:?}"); + std::fs::rename(&cfg_old, &config).unwrap_or_else(|err| { + error!( + "Could not rename. Please remove {} then restart service: Error {}", + self.file_name(), + err + ) + }); + do_rename = false; + } + if do_rename && !cfg_old.exists() { + warn!("Config {cfg_old:?} does not exist, looking for .conf next"); + cfg_old.pop(); + let tmp = self.file_name(); + let parts: Vec<_> = tmp.split('.').collect(); + cfg_old.push(format!("{}.conf", parts[0])); + } + if do_rename && cfg_old.exists() { + // Now we gotta rename it + warn!("Renaming {cfg_old:?} to {config:?}"); + std::fs::rename(&cfg_old, &config).unwrap_or_else(|err| { + error!( + "Could not rename. Please remove {} then restart service: Error {}", + self.file_name(), + err + ) + }); + } config } diff --git a/daemon-user/src/config.rs b/daemon-user/src/config.rs index bc0b3a6d..fef850f8 100644 --- a/daemon-user/src/config.rs +++ b/daemon-user/src/config.rs @@ -108,7 +108,7 @@ impl StdConfig for ConfigAnime { } fn file_name(&self) -> String { - format!("{}.cfg", self.name) + format!("{}.ron", self.name) } fn config_dir() -> std::path::PathBuf { @@ -180,7 +180,7 @@ impl StdConfig for ConfigAura { } fn file_name(&self) -> String { - format!("{}.cfg", self.name) + format!("{}.ron", self.name) } fn config_dir() -> std::path::PathBuf { @@ -208,7 +208,7 @@ impl StdConfig for ConfigBase { } fn file_name(&self) -> String { - "rog-user.cfg".to_owned() + "rog-user.ron".to_owned() } fn config_dir() -> std::path::PathBuf { diff --git a/daemon/src/config.rs b/daemon/src/config.rs index 9861a929..5ce70570 100644 --- a/daemon/src/config.rs +++ b/daemon/src/config.rs @@ -1,7 +1,7 @@ use config_traits::{StdConfig, StdConfigLoad3}; use serde_derive::{Deserialize, Serialize}; -const CONFIG_FILE: &str = "asusd.conf"; +const CONFIG_FILE: &str = "asusd.ron"; #[derive(Deserialize, Serialize, Default)] pub struct Config { diff --git a/daemon/src/ctrl_anime/config.rs b/daemon/src/ctrl_anime/config.rs index c00ecc5f..20dfa5aa 100644 --- a/daemon/src/ctrl_anime/config.rs +++ b/daemon/src/ctrl_anime/config.rs @@ -5,7 +5,7 @@ use rog_anime::error::AnimeError; use rog_anime::{ActionData, ActionLoader, AnimTime, AnimeType, Fade, Vec2}; use serde_derive::{Deserialize, Serialize}; -const CONFIG_FILE: &str = "anime.conf"; +const CONFIG_FILE: &str = "anime.ron"; #[derive(Deserialize, Serialize)] pub struct AnimeConfigV341 { diff --git a/daemon/src/ctrl_aura/config.rs b/daemon/src/ctrl_aura/config.rs index 9333821a..f49fd3c9 100644 --- a/daemon/src/ctrl_aura/config.rs +++ b/daemon/src/ctrl_aura/config.rs @@ -8,7 +8,7 @@ use rog_platform::hid_raw::HidRaw; use rog_platform::keyboard_led::KeyboardLed; use serde_derive::{Deserialize, Serialize}; -const CONFIG_FILE: &str = "aura.conf"; +const CONFIG_FILE: &str = "aura.ron"; /// Enable/disable LED control in various states such as /// when the device is awake, suspended, shutting down or diff --git a/daemon/src/ctrl_profiles/config.rs b/daemon/src/ctrl_profiles/config.rs index 7b360549..f21bae12 100644 --- a/daemon/src/ctrl_profiles/config.rs +++ b/daemon/src/ctrl_profiles/config.rs @@ -7,8 +7,8 @@ use serde_derive::{Deserialize, Serialize}; use crate::CONFIG_PATH_BASE; -const CONFIG_FILE: &str = "profile.conf"; -const CONFIG_FAN_FILE: &str = "fan_curves.conf"; +const CONFIG_FILE: &str = "profile.ron"; +const CONFIG_FAN_FILE: &str = "fan_curves.ron"; #[derive(Deserialize, Serialize, Debug)] pub struct ProfileConfig {