Compare commits

..

No commits in common. "502f1e89a5d493e7bafb80e53b3b6e3beaa79e50" and "b07d92188070e223e1585d3f9a0635fcedfe4b0f" have entirely different histories.

5 changed files with 13 additions and 12 deletions

View File

@ -4,7 +4,7 @@ use core::fmt;
use crate::enums::*; use crate::enums::*;
use untildify; use untildify;
#[derive(Debug, Clone)] #[derive(Debug)]
pub struct Monitors { pub struct Monitors {
pub monitors: Vec<MonitorType>, pub monitors: Vec<MonitorType>,
} }
@ -29,7 +29,7 @@ impl fmt::Display for Monitors {
} }
} }
#[derive(Debug, Clone)] #[derive(Debug)]
pub struct WallpaperDir { pub struct WallpaperDir {
ultrawide: String, ultrawide: String,
horizontal: String, horizontal: String,
@ -68,7 +68,7 @@ impl fmt::Display for WallpaperDir {
} }
} }
#[derive(Debug, Clone)] #[derive(Debug)]
pub struct Config { pub struct Config {
pub x_server: String, pub x_server: String,
pub wallpaper_engine: WallpaperHandler, pub wallpaper_engine: WallpaperHandler,

View File

@ -1,6 +1,6 @@
use core::fmt; use core::fmt;
#[derive(Debug, Clone)] #[derive(Debug)]
pub enum WallpaperHandler { pub enum WallpaperHandler {
Feh, Feh,
Plasma, Plasma,

View File

@ -6,7 +6,7 @@ use std::fmt::Write as _;
use crate::config::*; use crate::config::*;
use crate::enums::*; use crate::enums::*;
#[derive(Debug, Clone)] #[derive(Debug)]
pub struct Wallpaper { pub struct Wallpaper {
path: String, path: String,
} }
@ -23,7 +23,7 @@ impl fmt::Display for Wallpaper {
} }
} }
#[derive(Debug, Clone)] #[derive(Debug)]
pub struct Wallpapers { pub struct Wallpapers {
ultrawide: Vec<Wallpaper>, ultrawide: Vec<Wallpaper>,
horizontal: Vec<Wallpaper>, horizontal: Vec<Wallpaper>,
@ -32,12 +32,14 @@ pub struct Wallpapers {
} }
impl Wallpapers { impl Wallpapers {
pub fn new(config: Config) -> Wallpapers { pub fn new() -> Wallpapers {
Wallpapers { Wallpapers {
ultrawide: vec![], ultrawide: vec![],
horizontal: vec![], horizontal: vec![],
vertical: vec![], vertical: vec![],
config, config: Config::from_config(
"/home/ben/.config/wallpaperctl/wallpaperctl.ini".to_owned(),
),
} }
} }

View File

@ -1,3 +1,4 @@
use crate::config::Monitors;
use crate::handlers::dbus_plasma_interface; use crate::handlers::dbus_plasma_interface;
use crate::Wallpapers; use crate::Wallpapers;
@ -22,7 +23,7 @@ pub fn change_wallpapers(wallpapers: &Wallpapers) {
let javascript = generate_js(wallpapers); let javascript = generate_js(wallpapers);
let resp = proxy.evaluate_script(javascript.as_ref()); let resp = proxy.evaluate_script(javascript.as_ref());
match resp { match resp {
Ok(_str) => {} Ok(str) => {}
Err(e) => println!("{}", e), Err(e) => println!("{}", e),
} }
} }

View File

@ -1,13 +1,11 @@
mod config; mod config;
use config::*;
mod enums; mod enums;
mod files; mod files;
use files::*; use files::*;
mod handlers; mod handlers;
fn main() { fn main() {
let config = Config::from_config("/home/ben/.config/wallpaperctl/wallpaperctl.ini".to_owned()); let mut wallpapers = Wallpapers::new();
let mut wallpapers = Wallpapers::new(config.clone());
wallpapers.load_all(); wallpapers.load_all();
handlers::plasma::change_wallpapers(&wallpapers); handlers::plasma::change_wallpapers(&wallpapers);