Trait wallpaper_rs::Desktop[][src]

pub trait Desktop: Sized {
    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>>; }

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

fn new() -> Result<Self, Box<dyn Error>>[src]

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).

fn set_wallpaper(&self, path: &str) -> Result<(), Box<dyn Error>>[src]

Sets the wallpaper for all computer screens to the specified file path.

The file should be an image file supported by the patform, e.g. a JPEG.

fn get_wallpaper(&self) -> Result<PathBuf, Box<dyn Error>>[src]

Returns the file path to the image used as the wallpaper.

If different screens have different wallpapers, only one of them is returned; the behavior depends on the platform and desktop environment.

Loading content...

Implementors

impl Desktop for DesktopEnvt[src]

Loading content...