diff options
author | Mustafa Salih <37256744+MustafaSalih1993@users.noreply.github.com> | 2021-01-14 05:43:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-14 05:43:01 +0300 |
commit | e38859e0f0106b60f2dd6d2f8260ea16e5417a96 (patch) | |
tree | acdd23279a8fc837fa076739933b1269d74110fd /src/types.rs | |
parent | e829871f2d757c7414763992839a584038c7b443 (diff) | |
parent | 6a349a0e0282e56b03adbe02b41bfaf0cc3213f1 (diff) |
Merge pull request #34 from MustafaSalih1993/dev
orginized the code to seprated mods and deleted the lib file
Diffstat (limited to 'src/types.rs')
-rw-r--r-- | src/types.rs | 124 |
1 files changed, 124 insertions, 0 deletions
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<name::NameConnection>, + 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() + } +} |