pub trait Desktop: Sized {
// Required methods
fn new() -> Result<Self, Box<dyn Error>>;
fn set_wallpaper(&self, path: &str) -> Result<(), Box<dyn Error>>;
fn get_wallpaper(&self) -> Result<PathBuf, Box<dyn Error>>;
}
Expand description
A trait implemented by desktop environments. It allows setting or getting a wallpaper.
On platforms where only one desktop environment exists (e.g. Windows, macOS), this can be implemented with a zero-sized type. On Linux, it is an enum.
Required Methods§
Sourcefn new() -> Result<Self, Box<dyn Error>>
fn new() -> Result<Self, Box<dyn Error>>
Creates a new instance of this desktop.
On Linux, this function detects the desktop environment.
It panics if the desktop environment is unsupported. It returns an error
if the desktop environment couldn’t be determined (i.e., the XDG_CURRENT_DESKTOP
environment variable isn’t set).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.