use crate::{get_stdout, run, Error::UnsupportedDesktop, Mode, Result};
pub fn get() -> Result<String> {
get_stdout(
"osascript",
&[
"-e",
r#"tell application "Finder" to get POSIX path of (get desktop picture as alias)"#,
],
)
}
pub fn set_from_path(path: &str) -> Result<()> {
run(
"osascript",
&[
"-e",
&format!(
r#"tell application "System Events" to tell every desktop to set picture to {}"#,
enquote::enquote('"', path),
),
],
)
}
pub fn set_mode(_: Mode) -> Result<()> {
Err(UnsupportedDesktop)
}