Merge pull request #6031 from 21pages/wallpaper_remove_unsupported

not show remove wallpaper option if unsupported
This commit is contained in:
RustDesk
2023-10-14 22:22:37 +08:00
committed by GitHub
8 changed files with 68 additions and 20 deletions

View File

@@ -1341,6 +1341,14 @@ impl WallPaperRemover {
old_path_dark,
})
}
pub fn support() -> bool {
let desktop = std::env::var("XDG_CURRENT_DESKTOP").unwrap_or_default();
if wallpaper::gnome::is_compliant(&desktop) || desktop.as_str() == "XFCE" {
return wallpaper::get().is_ok();
}
false
}
}
impl Drop for WallPaperRemover {

View File

@@ -2392,6 +2392,10 @@ impl WallPaperRemover {
Ok(Self { old_path })
}
pub fn support() -> bool {
wallpaper::get().is_ok() || !Self::get_recent_wallpaper().unwrap_or_default().is_empty()
}
fn get_recent_wallpaper() -> ResultType<String> {
// SystemParametersInfoW may return %appdata%\Microsoft\Windows\Themes\TranscodedWallpaper, not real path and may not real cache
// https://www.makeuseof.com/find-desktop-wallpapers-file-location-windows-11/