pub struct Config {Show 15 fields
pub desktop: String,
pub directories: Vec<PathBuf>,
pub extensions: Vec<String>,
pub interval: u64,
pub min_dimension: u64,
pub max_dimension: u64,
pub min_size: u64,
pub max_size: u64,
pub monitors: Vec<Monitor>,
pub monitor_orientation: Orientation,
pub path_feh: PathBuf,
pub path_magick: PathBuf,
pub sort: bool,
pub verbose: bool,
pub wallpaper: PathBuf,
}Expand description
Configuration variables
Fields§
§desktop: StringDesktops: gnome, xfce, openbox, …
directories: Vec<PathBuf>Directories containing image files
extensions: Vec<String>Image file extension (identify -list format)
interval: u64Interval (in seconds) between each wallpaper displayed
min_dimension: u64Minimum dimension
max_dimension: u64Maximum dimension
min_size: u64Minimum file size
max_size: u64Maximum file size
monitors: Vec<Monitor>Monitor properties
monitor_orientation: OrientationAttach images to monitors in the Horizontal or Vertical orientation
path_feh: PathBuffeh binary path
path_magick: PathBufmagick binary path
sort: boolSort the images found.
verbose: boolShow intermediate runtime messages
wallpaper: PathBufWallpaper file path used by gnome desktop
Implementations§
Source§impl Config
impl Config
Sourcepub fn new() -> WallSwitchResult<Self>
pub fn new() -> WallSwitchResult<Self>
Read command line arguments with priority order:
- read config file || read default config
- set_command_line_arguments
- validate_config
- write_config_file
At the end add or update config file.
Sourcepub fn print(&self) -> WallSwitchResult<()>
pub fn print(&self) -> WallSwitchResult<()>
Print Config.
Sourcepub fn validate_config(self) -> WallSwitchResult<Self>
pub fn validate_config(self) -> WallSwitchResult<Self>
Validate configuration
Sourcepub fn write_config_file(
self,
path: &PathBuf,
read_default_config: bool,
) -> WallSwitchResult<Self>
pub fn write_config_file( self, path: &PathBuf, read_default_config: bool, ) -> WallSwitchResult<Self>
Write config file path:: “/home/user_name/.config/wallswitch/wallswitch.json”
Sourcepub fn get_number_of_images(&self) -> usize
pub fn get_number_of_images(&self) -> usize
Get the number of images per cycle
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more