Update readme, slash configs

This commit is contained in:
Luke D. Jones
2025-01-12 17:36:10 +13:00
parent 2123f369ad
commit 128bc3fce1
113 changed files with 1545 additions and 1305 deletions

View File

@@ -21,7 +21,7 @@ fn root_conf_dir() -> PathBuf {
#[derive(Debug, Deserialize, Serialize)]
pub struct ConfigAnime {
pub name: String,
pub anime: Vec<ActionLoader>,
pub anime: Vec<ActionLoader>
}
impl ConfigAnime {
@@ -52,8 +52,8 @@ impl Default for ConfigAnime {
time: AnimTime::Fade(Fade::new(
Duration::from_secs(2),
None,
Duration::from_secs(2),
)),
Duration::from_secs(2)
))
},
ActionLoader::AsusAnimation {
file: "/usr/share/asusd/anime/asus/rog/Sunset.gif".into(),
@@ -61,8 +61,8 @@ impl Default for ConfigAnime {
time: AnimTime::Fade(Fade::new(
Duration::from_secs(6),
None,
Duration::from_secs(3),
)),
Duration::from_secs(3)
))
},
ActionLoader::ImageAnimation {
file: "/usr/share/asusd/anime/custom/sonic-run.gif".into(),
@@ -73,8 +73,8 @@ impl Default for ConfigAnime {
time: AnimTime::Fade(Fade::new(
Duration::from_secs(2),
Some(Duration::from_secs(2)),
Duration::from_secs(2),
)),
Duration::from_secs(2)
))
},
ActionLoader::Image {
file: "/usr/share/asusd/anime/custom/rust.png".into(),
@@ -84,9 +84,9 @@ impl Default for ConfigAnime {
time: AnimTime::Fade(Fade::new(
Duration::from_secs(2),
Some(Duration::from_secs(1)),
Duration::from_secs(2),
Duration::from_secs(2)
)),
brightness: 0.6,
brightness: 0.6
},
ActionLoader::Pause(Duration::from_secs(1)),
ActionLoader::ImageAnimation {
@@ -95,9 +95,9 @@ impl Default for ConfigAnime {
angle: 0.0,
translation: Vec2::new(3.0, 2.0),
brightness: 0.5,
time: AnimTime::Count(2),
time: AnimTime::Count(2)
},
],
]
}
}
}
@@ -121,7 +121,7 @@ impl StdConfigLoad for ConfigAnime {}
#[derive(Debug, Deserialize, Serialize)]
pub struct ConfigAura {
pub name: String,
pub aura: AuraSequences,
pub aura: AuraSequences
}
impl ConfigAura {
@@ -139,14 +139,14 @@ impl Default for ConfigAura {
Colour {
r: 255,
g: 0,
b: 20,
b: 20
},
Colour {
r: 20,
g: 255,
b: 0,
b: 0
},
Speed::Low,
Speed::Low
));
seq.push(key.clone());
@@ -161,7 +161,7 @@ impl Default for ConfigAura {
LedCode::F,
Colour { r: 255, g: 0, b: 0 },
Colour { r: 255, g: 0, b: 0 },
Speed::High,
Speed::High
));
seq.push(key);
@@ -176,13 +176,13 @@ impl Default for ConfigAura {
LedCode::N9,
Colour { r: 0, g: 0, b: 255 },
80,
40,
40
));
seq.push(key);
Self {
name: "aura-default".to_owned(),
aura: seq,
aura: seq
}
}
}
@@ -209,14 +209,14 @@ pub struct ConfigBase {
/// Name of active anime config file in the user config directory
pub active_anime: Option<String>,
/// Name of active aura config file in the user config directory
pub active_aura: Option<String>,
pub active_aura: Option<String>
}
impl StdConfig for ConfigBase {
fn new() -> Self {
Self {
active_anime: Some("anime-default".to_owned()),
active_aura: Some("aura-default".to_owned()),
active_aura: Some("aura-default".to_owned())
}
}

View File

@@ -25,7 +25,7 @@ pub struct Timer {
/// Used only for `TimeType::Timer`, milliseonds to fade the image in for
fade_in: u64,
/// Used only for `TimeType::Timer`, milliseonds to fade the image out for
fade_out: u64,
fade_out: u64
}
impl From<Timer> for AnimTime {
@@ -46,7 +46,7 @@ impl From<Timer> for AnimTime {
}
}
TimeType::Count => AnimTime::Count(time.count as u32),
TimeType::Infinite => AnimTime::Infinite,
TimeType::Infinite => AnimTime::Infinite
}
}
}
@@ -55,7 +55,7 @@ impl From<Timer> for AnimTime {
pub enum TimeType {
Timer,
Count,
Infinite,
Infinite
}
/// The inner object exists to allow the zbus proxy to share it with a runner
@@ -63,19 +63,19 @@ pub enum TimeType {
pub struct CtrlAnimeInner<'a> {
sequences: Sequences,
client: AnimeProxyBlocking<'a>,
do_early_return: Arc<AtomicBool>,
do_early_return: Arc<AtomicBool>
}
impl CtrlAnimeInner<'static> {
pub fn new(
sequences: Sequences,
client: AnimeProxyBlocking<'static>,
do_early_return: Arc<AtomicBool>,
do_early_return: Arc<AtomicBool>
) -> Result<Self, Error> {
Ok(Self {
sequences,
client,
do_early_return,
do_early_return
})
}
@@ -130,7 +130,7 @@ pub struct CtrlAnime<'a> {
client: AnimeProxyBlocking<'a>,
inner: Arc<Mutex<CtrlAnimeInner<'a>>>,
/// Must be the same Atomic as in CtrlAnimeInner
inner_early_return: Arc<AtomicBool>,
inner_early_return: Arc<AtomicBool>
}
impl CtrlAnime<'static> {
@@ -138,13 +138,13 @@ impl CtrlAnime<'static> {
config: Arc<Mutex<ConfigAnime>>,
inner: Arc<Mutex<CtrlAnimeInner<'static>>>,
client: AnimeProxyBlocking<'static>,
inner_early_return: Arc<AtomicBool>,
inner_early_return: Arc<AtomicBool>
) -> Result<Self, Error> {
Ok(CtrlAnime {
config,
client,
inner,
inner_early_return,
inner_early_return
})
}
@@ -174,7 +174,7 @@ impl CtrlAnime<'static> {
index: u32,
file: &str,
time: Timer,
brightness: f32,
brightness: f32
) -> zbus::fdo::Result<String> {
if let Ok(mut config) = self.config.try_lock() {
let time: AnimTime = time.into();
@@ -182,7 +182,7 @@ impl CtrlAnime<'static> {
let action = ActionLoader::AsusAnimation {
file: file.into(),
brightness,
time,
time
};
// Must make the inner run loop return early
@@ -216,7 +216,7 @@ impl CtrlAnime<'static> {
angle: f32,
xy: (f32, f32),
time: Timer,
brightness: f32,
brightness: f32
) -> zbus::fdo::Result<String> {
if let Ok(mut config) = self.config.try_lock() {
let time: AnimTime = time.into();
@@ -228,7 +228,7 @@ impl CtrlAnime<'static> {
angle,
translation,
brightness,
time,
time
};
// Must make the inner run loop return early
@@ -261,7 +261,7 @@ impl CtrlAnime<'static> {
angle: f32,
xy: (f32, f32),
time: Timer,
brightness: f32,
brightness: f32
) -> zbus::fdo::Result<String> {
if let Ok(mut config) = self.config.try_lock() {
let file = Path::new(&file);
@@ -272,7 +272,7 @@ impl CtrlAnime<'static> {
angle,
translation: Vec2::new(xy.0, xy.1),
brightness,
time,
time
};
// Must make the inner run loop return early

View File

@@ -61,16 +61,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
CtrlAnimeInner::new(
anime,
anime_proxy_blocking.clone(),
early_return.clone(),
early_return.clone()
)
.unwrap(),
.unwrap()
));
// Need new client object for dbus control part
let anime_control = CtrlAnime::new(
anime_config,
inner.clone(),
anime_proxy_blocking,
early_return,
early_return
)
.unwrap();
anime_control.add_to_server(&mut connection).await;

View File

@@ -8,7 +8,7 @@ pub enum Error {
ConfigLoadFail,
ConfigLockFail,
XdgVars,
Anime(AnimeError),
Anime(AnimeError)
}
impl fmt::Display for Error {
@@ -19,7 +19,7 @@ impl fmt::Display for Error {
Error::ConfigLoadFail => write!(f, "Failed to load user config"),
Error::ConfigLockFail => write!(f, "Failed to lock user config"),
Error::XdgVars => write!(f, "XDG environment vars appear unset"),
Error::Anime(err) => write!(f, "Anime error: {}", err),
Error::Anime(err) => write!(f, "Anime error: {}", err)
}
}
}

View File

@@ -32,7 +32,7 @@ trait Daemon {
file: &str,
time: u32,
count: u32,
brightness: f64,
brightness: f64
) -> zbus::Result<String>;
/// InsertImage method
@@ -43,7 +43,7 @@ trait Daemon {
scale: f64,
angle: f64,
xy: &(f64, f64),
brightness: f64,
brightness: f64
) -> zbus::Result<String>;
/// InsertImageGif method
@@ -56,7 +56,7 @@ trait Daemon {
xy: &(f64, f64),
time: u32,
count: u32,
brightness: f64,
brightness: f64
) -> zbus::Result<String>;
/// InsertPause method