aboutsummaryrefslogtreecommitdiff
path: root/src/types.rs
diff options
context:
space:
mode:
authormustafa salih <mustafasalih1991@gmail.com>2021-01-14 05:41:01 +0300
committermustafa salih <mustafasalih1991@gmail.com>2021-01-14 05:41:01 +0300
commit6a349a0e0282e56b03adbe02b41bfaf0cc3213f1 (patch)
treeacdd23279a8fc837fa076739933b1269d74110fd /src/types.rs
parente829871f2d757c7414763992839a584038c7b443 (diff)
orginized the code to seprated mods and deleted the lib file
Diffstat (limited to 'src/types.rs')
-rw-r--r--src/types.rs124
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()
+ }
+}