Skip to content

Commit

Permalink
Can change wallpaper on Linux (Gnome)
Browse files Browse the repository at this point in the history
Signed-off-by: Thibault Meyer <meyer.thibault@gmail.com>
  • Loading branch information
thibaultmeyer committed Jul 22, 2023
1 parent 60d66d0 commit e223260
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/bingwallpaper/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub fn load_application_configuration(file_name: Option<String>) -> BingWallpape

match confy::load_path(user_configuration_file) {
Err(error) => panic!("Can't load or create configuration file: {:?}", error),
Ok(configuration) => return configuration,
};
Ok(configuration) => configuration,
}
}
}
10 changes: 8 additions & 2 deletions src/bingwallpaper/wallpaper_changer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,14 @@ pub fn change_wallpaper(configuration: &BingWallpaperConfiguration) {
/// # Arguments
/// * `file_name` - The picture file name
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]
fn change_wallpaper_linux(_file_name: &String) {
panic!("Linux is not yet handled") // TODO: rename _file_name -> file_name
fn change_wallpaper_linux(file_name: &String) {
Command::new("gsettings")
.arg("set")
.arg("org.gnome.desktop.background")
.arg("picture-uri")
.arg(file_name)
.spawn()
.expect("Can't change wallpaper");
}

/// Changes the wallpaper with the given picture on MacOS.
Expand Down

0 comments on commit e223260

Please sign in to comment.