diff --git a/lib/background.rs b/lib/background.rs index 11749e9a3e9c7dc855a1938bc9991eaeb26df94f..7a973acf1d4df9a3f11c6817e0c98a0a7d28e305 100644 --- a/lib/background.rs +++ b/lib/background.rs @@ -41,7 +41,11 @@ pub fn process_image_url(image_url: String) -> MBGResult<()> { pub fn set_wallpaper(path: &str) { debug!("Setting background"); - let out = Command::new("feh").arg("--bg-fill").arg(path).output(); + let config = Config::get_props(); + let out = Command::new("sh") + .arg("-c") + .arg(config.set_command.replace(r"{}", path)) + .output(); if let Err(set_error) = out { error!("Can't set background: {}", set_error.to_string()); } diff --git a/lib/config/mod.rs b/lib/config/mod.rs index 97279bbf3f47556c2b39577a2dc99bcd47924ab7..92f185c27ba04494600b1a0dd75e3105ec26874a 100644 --- a/lib/config/mod.rs +++ b/lib/config/mod.rs @@ -12,6 +12,8 @@ pub mod logger; pub struct Config { #[serde(default)] pub blender: Vec<u8>, + #[serde(default = "set_command_default")] + pub set_command: String, #[serde(default = "reset_command_default")] pub reset_command: String, #[serde(default)] @@ -24,6 +26,10 @@ pub fn reset_command_default() -> String { String::from("nitrogen --restore") } +pub fn set_command_default() -> String { + String::from(r#"nitrogen --set-auto "{}""#) +} + impl Config { fn new() -> Self { Config { diff --git a/lib/result.rs b/lib/result.rs index d18543aa4ba4898ebe74d1421fe7f332da271078..25af0a9b85f1671ab06879eb482ea890bde5ed1c 100644 --- a/lib/result.rs +++ b/lib/result.rs @@ -54,4 +54,4 @@ impl From<image::error::ImageError> for MBGError { fn from(err: image::error::ImageError) -> Self { MBGError::ImageError(err.to_string()) } -} \ No newline at end of file +}