| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -16,6 +16,7 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//! TOML configuration for swayrbar.
 | 
					 | 
					 | 
					 | 
					//! TOML configuration for swayrbar.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use crate::module::BarModuleFn; | 
					 | 
					 | 
					 | 
					use crate::module::BarModuleFn; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					use crate::shared::cfg; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use serde::{Deserialize, Serialize}; | 
					 | 
					 | 
					 | 
					use serde::{Deserialize, Serialize}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use std::collections::HashMap; | 
					 | 
					 | 
					 | 
					use std::collections::HashMap; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -25,8 +26,7 @@ pub struct Config { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    pub refresh_interval: u64, | 
					 | 
					 | 
					 | 
					    pub refresh_interval: u64, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /// The list of modules to display in the given order, each one specified
 | 
					 | 
					 | 
					 | 
					    /// The list of modules to display in the given order, each one specified
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /// as `"<module_type>/<instance>"`.
 | 
					 | 
					 | 
					 | 
					    /// as `"<module_type>/<instance>"`.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    pub modules: Vec<String>, | 
					 | 
					 | 
					 | 
					    pub modules: Vec<ModuleConfig>, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    pub module_configs: Vec<ModuleConfig>, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#[derive(Debug, Serialize, Deserialize)] | 
					 | 
					 | 
					 | 
					#[derive(Debug, Serialize, Deserialize)] | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -42,8 +42,13 @@ impl Default for Config { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    fn default() -> Self { | 
					 | 
					 | 
					 | 
					    fn default() -> Self { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Config { | 
					 | 
					 | 
					 | 
					        Config { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            refresh_interval: 1000, | 
					 | 
					 | 
					 | 
					            refresh_interval: 1000, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            modules: vec!["date/0".to_owned()], | 
					 | 
					 | 
					 | 
					            modules: vec![ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            module_configs: vec![ | 
					 | 
					 | 
					 | 
					                crate::module::window::BarModuleWindow::default_config( | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    "0".to_owned(), | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                ), | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                crate::module::sysinfo::BarModuleSysInfo::default_config( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    "0".to_owned(), | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                ), | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                crate::module::date::BarModuleDate::default_config( | 
					 | 
					 | 
					 | 
					                crate::module::date::BarModuleDate::default_config( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    "0".to_owned(), | 
					 | 
					 | 
					 | 
					                    "0".to_owned(), | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ), | 
					 | 
					 | 
					 | 
					                ), | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -51,3 +56,13 @@ impl Default for Config { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					pub fn load_config() -> Config { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    cfg::load_config::<Config>("swayrbar") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					#[test] | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					fn test_load_swayrbar_config() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    let cfg = cfg::load_config::<Config>("swayrbar"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    println!("{:?}", cfg); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
  |