From 6a349a0e0282e56b03adbe02b41bfaf0cc3213f1 Mon Sep 17 00:00:00 2001 From: mustafa salih Date: Thu, 14 Jan 2021 05:41:01 +0300 Subject: orginized the code to seprated mods and deleted the lib file --- src/types.rs | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 src/types.rs (limited to 'src/types.rs') diff --git a/src/types.rs b/src/types.rs new file mode 100644 index 0000000..99e0701 --- /dev/null +++ b/src/types.rs @@ -0,0 +1,124 @@ +use breadx::{display::*, window::Window}; + +#[derive(Debug, Clone)] +pub enum ThreadsData { + Mpd(String), + Sound(String), + Disk(String), + Memory(String), + Time(String), + Weather(String), + Battery(String), + CpuTemp(String), + Uptime(String), + Spotify(String), +} + +#[derive(Clone)] +pub struct Config { + pub seperator: String, + pub time: Time, + pub memory: Memory, + pub disk: Disk, + pub volume: Volume, + pub weather: Weather, + pub battery: Battery, + pub cpu_temperature: CpuTemp, + pub uptime: Uptime, + pub mpd: Mpd, + pub spotify: Spotify, +} + +#[derive(Clone)] +pub struct Time { + pub format: String, + pub icon: String, + pub delay: f64, +} + +#[derive(Clone)] +pub struct Memory { + pub icon: String, + pub enabled: bool, + pub delay: f64, +} + +#[derive(Clone)] +pub struct Disk { + pub icon: String, + pub enabled: bool, + pub delay: f64, +} +#[derive(Clone)] +pub struct Volume { + pub icon: String, + pub enabled: bool, + pub delay: f64, + pub card: String, +} + +#[derive(Clone)] +pub struct Weather { + pub city: String, + pub format: String, + pub icon: String, + pub enabled: bool, + pub delay: f64, +} + +#[derive(Clone)] +pub struct Battery { + pub source: String, + pub icon: String, + pub enabled: bool, + pub delay: f64, +} + +#[derive(Clone)] +pub struct CpuTemp { + pub icon: String, + pub enabled: bool, + pub delay: f64, +} + +#[derive(Clone)] +pub struct Uptime { + pub icon: String, + pub enabled: bool, + pub delay: f64, +} + +#[derive(Clone)] +pub struct Mpd { + pub icon: String, + pub host: String, + pub port: String, + pub enabled: bool, + pub delay: f64, +} + +#[derive(Clone)] +pub struct Spotify { + pub icon: String, + pub enabled: bool, + pub delay: f64, +} + +pub struct Blocks { + pub disp: Display, + pub root: Window, +} + +impl Blocks { + pub fn new() -> Self { + let disp = Display::create(None, None).expect("Failed to create x11 connection"); + let root = disp.default_screen().root; + Self { disp, root } + } +} + +impl Default for Blocks { + fn default() -> Self { + Self::new() + } +} -- cgit v1.2.3