From a2e1b3343c479349611ee46c06e614d4c7d5fb63 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Fri, 8 Apr 2022 21:29:55 +0200 Subject: [PATCH] Flatten swayrbar structure --- swayrbar/src/bar.rs | 7 +++---- swayrbar/src/bin/swayrbar.rs | 2 +- swayrbar/src/{bar => }/config.rs | 4 ++-- swayrbar/src/lib.rs | 2 ++ swayrbar/src/{bar => }/module.rs | 2 +- swayrbar/src/{bar => }/module/battery.rs | 4 ++-- swayrbar/src/{bar => }/module/date.rs | 4 ++-- swayrbar/src/{bar => }/module/sysinfo.rs | 4 ++-- swayrbar/src/{bar => }/module/window.rs | 4 ++-- 9 files changed, 17 insertions(+), 16 deletions(-) rename swayrbar/src/{bar => }/config.rs (93%) rename swayrbar/src/{bar => }/module.rs (98%) rename swayrbar/src/{bar => }/module/battery.rs (98%) rename swayrbar/src/{bar => }/module/date.rs (97%) rename swayrbar/src/{bar => }/module/sysinfo.rs (98%) rename swayrbar/src/{bar => }/module/window.rs (97%) diff --git a/swayrbar/src/bar.rs b/swayrbar/src/bar.rs index 49ae522..493e2b6 100644 --- a/swayrbar/src/bar.rs +++ b/swayrbar/src/bar.rs @@ -15,7 +15,9 @@ //! `swayrbar` lib. -use crate::bar::module::BarModuleFn; +use crate::config; +use crate::module; +use crate::module::BarModuleFn; use env_logger::Env; use serde_json; use std::io; @@ -23,9 +25,6 @@ use std::process as p; use std::{sync::Arc, thread}; use swaybar_types as sbt; -pub mod config; -pub mod module; - pub fn start() { env_logger::Builder::from_env(Env::default().default_filter_or("warn")) .init(); diff --git a/swayrbar/src/bin/swayrbar.rs b/swayrbar/src/bin/swayrbar.rs index 507a61e..582173a 100644 --- a/swayrbar/src/bin/swayrbar.rs +++ b/swayrbar/src/bin/swayrbar.rs @@ -18,5 +18,5 @@ fn main() { // TODO: We need a config file cmd line option so that each bar can have // its own config. - swayrbar::bar::start(); + swayrbar::bar::start() } diff --git a/swayrbar/src/bar/config.rs b/swayrbar/src/config.rs similarity index 93% rename from swayrbar/src/bar/config.rs rename to swayrbar/src/config.rs index df5a2b2..21ef762 100644 --- a/swayrbar/src/bar/config.rs +++ b/swayrbar/src/config.rs @@ -15,7 +15,7 @@ //! TOML configuration for swayrbar. -use crate::bar::module::BarModuleFn; +use crate::module::BarModuleFn; use serde::{Deserialize, Serialize}; use std::collections::HashMap; @@ -44,7 +44,7 @@ impl Default for Config { refresh_interval: 1000, modules: vec!["date/0".to_owned()], module_configs: vec![ - crate::bar::module::date::BarModuleDate::default_config( + crate::module::date::BarModuleDate::default_config( "0".to_owned(), ), ], diff --git a/swayrbar/src/lib.rs b/swayrbar/src/lib.rs index 4cba831..96fe09d 100644 --- a/swayrbar/src/lib.rs +++ b/swayrbar/src/lib.rs @@ -14,4 +14,6 @@ // this program. If not, see . pub mod bar; +pub mod config; +pub mod module; pub mod shared; diff --git a/swayrbar/src/bar/module.rs b/swayrbar/src/module.rs similarity index 98% rename from swayrbar/src/bar/module.rs rename to swayrbar/src/module.rs index 47790b1..55e384b 100644 --- a/swayrbar/src/bar/module.rs +++ b/swayrbar/src/module.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; -use crate::bar::config; +use crate::config; use swaybar_types as s; pub mod battery; diff --git a/swayrbar/src/bar/module/battery.rs b/swayrbar/src/module/battery.rs similarity index 98% rename from swayrbar/src/bar/module/battery.rs rename to swayrbar/src/module/battery.rs index 8d91d5a..782238d 100644 --- a/swayrbar/src/bar/module/battery.rs +++ b/swayrbar/src/module/battery.rs @@ -15,8 +15,8 @@ //! The date `swayrbar` module. -use crate::bar::config; -use crate::bar::module::BarModuleFn; +use crate::config; +use crate::module::BarModuleFn; use crate::shared::fmt::format_placeholders; use battery as bat; use std::collections::{HashMap, HashSet}; diff --git a/swayrbar/src/bar/module/date.rs b/swayrbar/src/module/date.rs similarity index 97% rename from swayrbar/src/bar/module/date.rs rename to swayrbar/src/module/date.rs index b8ec3ca..ccd7f17 100644 --- a/swayrbar/src/bar/module/date.rs +++ b/swayrbar/src/module/date.rs @@ -17,8 +17,8 @@ use std::collections::HashMap; -use crate::bar::module::config; -use crate::bar::module::BarModuleFn; +use crate::module::config; +use crate::module::BarModuleFn; use swaybar_types as s; const NAME: &str = "date"; diff --git a/swayrbar/src/bar/module/sysinfo.rs b/swayrbar/src/module/sysinfo.rs similarity index 98% rename from swayrbar/src/bar/module/sysinfo.rs rename to swayrbar/src/module/sysinfo.rs index b887077..d1e9104 100644 --- a/swayrbar/src/bar/module/sysinfo.rs +++ b/swayrbar/src/module/sysinfo.rs @@ -15,8 +15,8 @@ //! The date `swayrbar` module. -use crate::bar::config; -use crate::bar::module::BarModuleFn; +use crate::config; +use crate::module::BarModuleFn; use crate::shared::fmt::format_placeholders; use std::collections::HashMap; use std::sync::Mutex; diff --git a/swayrbar/src/bar/module/window.rs b/swayrbar/src/module/window.rs similarity index 97% rename from swayrbar/src/bar/module/window.rs rename to swayrbar/src/module/window.rs index e32c2e4..6a1640e 100644 --- a/swayrbar/src/bar/module/window.rs +++ b/swayrbar/src/module/window.rs @@ -17,8 +17,8 @@ use std::collections::HashMap; -use crate::bar::config; -use crate::bar::module::BarModuleFn; +use crate::config; +use crate::module::BarModuleFn; use crate::shared::fmt::format_placeholders; use crate::shared::ipc; use crate::shared::ipc::NodeMethods;