71 lines
1.4 KiB
Rust
71 lines
1.4 KiB
Rust
use core::fmt;
|
|
|
|
#[derive(Debug)]
|
|
pub enum WallpaperHandler {
|
|
Feh,
|
|
Plasma,
|
|
Gnome,
|
|
Error,
|
|
}
|
|
|
|
impl WallpaperHandler {
|
|
pub fn new(handler: String) -> WallpaperHandler {
|
|
match handler.as_str() {
|
|
"feh" => WallpaperHandler::Feh,
|
|
"plasma" => WallpaperHandler::Plasma,
|
|
"gnome" => WallpaperHandler::Gnome,
|
|
_ => WallpaperHandler::Error,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl fmt::Display for WallpaperHandler {
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
write!(f, "{:?}", self)
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub enum MonitorType {
|
|
Ultrawide,
|
|
Horizontal,
|
|
Vertical,
|
|
Error,
|
|
}
|
|
|
|
impl MonitorType {
|
|
pub fn new(mon_type: String) -> MonitorType {
|
|
match mon_type.as_str() {
|
|
"ultrawide" => MonitorType::Ultrawide,
|
|
"vertical" => MonitorType::Vertical,
|
|
"horizontal" => MonitorType::Horizontal,
|
|
_ => MonitorType::Error,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl fmt::Display for MonitorType {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
write!(f, "{:?}", self)
|
|
}
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub enum ImageTypes {
|
|
PNG,
|
|
JPG,
|
|
JPEG,
|
|
}
|
|
|
|
impl ImageTypes {
|
|
pub fn get_types() -> Vec<String> {
|
|
vec!["png".to_string(), "jpg".to_string(), "jpeg".to_string()]
|
|
}
|
|
}
|
|
|
|
impl fmt::Display for ImageTypes {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
write!(f, "{:?}", self)
|
|
}
|
|
}
|