show wallpaper only when support, show test on checked

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-10-14 18:50:41 +08:00
parent 5e616dd502
commit 68ef1fc9e0
8 changed files with 75 additions and 21 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/