diff --git a/src/common/lib.rs b/src/common/lib.rs index 16ff55e..b4f909a 100644 --- a/src/common/lib.rs +++ b/src/common/lib.rs @@ -47,6 +47,7 @@ pub enum GetArgs { Wallpaper, Duration, Mode, + Fallback, } fn parse_duration(arg: &str) -> Result { @@ -77,6 +78,7 @@ impl Display for Command { GetArgs::Wallpaper => "get wallpaper".to_string(), GetArgs::Duration => "get duration".to_string(), GetArgs::Mode => "get mode".to_string(), + GetArgs::Fallback => "get fallback".to_string(), }, }; write!(f, "{args}") diff --git a/src/daemon/daemon.rs b/src/daemon/daemon.rs index fef6611..af9816d 100644 --- a/src/daemon/daemon.rs +++ b/src/daemon/daemon.rs @@ -207,12 +207,12 @@ fn handle_connection(mut stream: UnixStream, state: Arc>) -> bool { .to_str() .unwrap_or("ERROR") .to_owned(), - GetArgs::Duration => { - format!( - "{} seconds", - state.lock().unwrap().get_change_interval().as_secs() - ) - } + GetArgs::Duration => state + .lock() + .unwrap() + .get_change_interval() + .as_secs() + .to_string(), GetArgs::Mode => { let action = state.lock().unwrap().get_action(); match action { @@ -221,6 +221,7 @@ fn handle_connection(mut stream: UnixStream, state: Arc>) -> bool { NextImage::Random => "Random".to_string(), } } + GetArgs::Fallback => state.lock().unwrap().get_fallback().to_string(), } } } diff --git a/src/daemon/state.rs b/src/daemon/state.rs index d8d3aae..7c6cc22 100644 --- a/src/daemon/state.rs +++ b/src/daemon/state.rs @@ -205,4 +205,8 @@ impl State { pub fn get_change_interval(&self) -> Duration { self.change_interval } + + pub fn get_fallback(&self) -> bool { + self.use_fallback + } }