diff --git a/src/helpers.rs b/src/helpers.rs index 73b5ef8..4ac6777 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -73,9 +73,6 @@ pub fn set_wallpaper(source: &Source, wallpaper_cfg: wallpaper::Wallpaper) -> Re #[cfg(target_os = "macos")] wallpaper::macos::set(&path)?; #[cfg(any(target_os = "linux", target_os = "netbsd"))] - wallpaper::unix::set( - path, - wallpaper_cfg - )?; + wallpaper::unix::set(path, wallpaper_cfg)?; Ok(()) } diff --git a/src/util/config.rs b/src/util/config.rs index 4f1655c..25d26c1 100644 --- a/src/util/config.rs +++ b/src/util/config.rs @@ -8,8 +8,8 @@ use color_eyre::{Help, Report}; use serde::{Deserialize, Serialize}; use super::arguments::Cli; -use crate::Template; use crate::wallpaper::Wallpaper; +use crate::Template; #[derive(Serialize, Deserialize, Debug)] pub struct Config { diff --git a/src/wallpaper/unix.rs b/src/wallpaper/unix.rs index 084dd7f..2f7c2a7 100644 --- a/src/wallpaper/unix.rs +++ b/src/wallpaper/unix.rs @@ -1,35 +1,39 @@ -use color_eyre::Report; -use std::process::{Command, Stdio}; use crate::wallpaper::Wallpaper; +use color_eyre::Report; use execute::Execute; +use std::process::{Command, Stdio}; #[cfg(any(target_os = "linux", target_os = "netbsd"))] pub fn set( path: &String, - Wallpaper { pre_hook, command, arguments, .. }: Wallpaper, + Wallpaper { + pre_hook, + command, + arguments, + .. + }: Wallpaper, ) -> Result<(), Report> { info!("Setting wallpaper..."); if let Some(hook) = pre_hook { - spawn_hook(hook)? + spawn_hook(hook)? } let mut binding = Command::new(&command); - let cmd = binding - .stdout(Stdio::null()) - .stderr(Stdio::null()); + let cmd = binding.stdout(Stdio::null()).stderr(Stdio::null()); if let Some(args) = arguments { - cmd.args(args); + cmd.args(args); } cmd.arg(path); - match cmd.spawn() { Ok(_) => info!("Successfully set the wallpaper with {command}"), Err(e) => { if let std::io::ErrorKind::NotFound = e.kind() { - error!("Failed to set wallpaper, the program {command} was not found in PATH!") + error!( + "Failed to set wallpaper, the program {command} was not found in PATH!" + ) } else { error!("Some error(s) occured while setting wallpaper!"); } @@ -38,8 +42,6 @@ pub fn set( Ok(()) } - - #[cfg(any(target_os = "linux", target_os = "netbsd"))] fn spawn_hook(hook: String) -> Result<(), Report> { let mut command = execute::shell(&hook);