Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckyTurtleDev committed Feb 19, 2024
1 parent 95308f1 commit c0d04ec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion more-wallpapers/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[cfg(target_os = "linux")]
use std::env;
use std::{io, process::Command, ffi::OsString};
use std::{ffi::OsString, io, process::Command};
use thiserror::Error;

#[cfg(target_os = "linux")]
Expand Down
4 changes: 1 addition & 3 deletions more-wallpapers/src/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ where
}

/// allow also checking more complex commands
fn run_command(
mut command: Command,
) -> Result<Vec<u8>, CommandError> {
fn run_command(mut command: Command) -> Result<Vec<u8>, CommandError> {
let output = command.output();
let output = output.map_err(|err| CommandError::CommandIO(command.get_program().into(), err))?;
if !output.status.success() {
Expand Down
18 changes: 9 additions & 9 deletions more-wallpapers/src/linux/xfce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ use super::run_command;
use crate::{Mode, Screen, WallpaperError};
use std::{collections::HashMap, ffi::OsStr, process::Command};

fn load_property(property: &str) -> Result<String, WallpaperError> {
let mut command = Command::new("xfconf-query");
command.args(["--channel", "xfce4-desktop", "p"]);
command.arg(property);
let output = run_command(command)?;
let output = String::from_utf8(output).unwrap();
Ok(output)
}

pub(crate) fn get_screens() -> Result<Vec<Screen>, WallpaperError> {
fn load_property(property: &str) -> Result<String, WallpaperError> {
let mut command = Command::new("xfconf-query");
command.args(["--channel", "xfce4-desktop", "-p"]);
command.arg(property);
let output = run_command(command)?;
let output = String::from_utf8(output).unwrap();
Ok(output)
}

let mut command = Command::new("xfconf-query");
command.args(["--channel", "xfce4-desktop", "--list"]);
let output = run_command(command)?;
Expand Down

0 comments on commit c0d04ec

Please sign in to comment.