Assume empty config if no default is found
This commit is contained in:
parent
e33b16e2c7
commit
89a0ac6143
2 changed files with 14 additions and 1 deletions
|
@ -30,7 +30,7 @@ pub struct RawConfig {
|
||||||
pub settings: HashMap<String, String>,
|
pub settings: HashMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Default, Debug, Clone)]
|
||||||
pub struct MappedModifiers {
|
pub struct MappedModifiers {
|
||||||
pub default: Vec<Key>,
|
pub default: Vec<Key>,
|
||||||
pub custom: Vec<Key>,
|
pub custom: Vec<Key>,
|
||||||
|
@ -77,6 +77,16 @@ impl Config {
|
||||||
mapped_modifiers,
|
mapped_modifiers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_empty(file_name: String) -> Self {
|
||||||
|
Self {
|
||||||
|
name: file_name,
|
||||||
|
bindings: Default::default(),
|
||||||
|
combinations: Default::default(),
|
||||||
|
settings: Default::default(),
|
||||||
|
mapped_modifiers: Default::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_raw_config(raw_config: RawConfig) -> (Bindings, Combinations, HashMap<String, String>, MappedModifiers) {
|
fn parse_raw_config(raw_config: RawConfig) -> (Bindings, Combinations, HashMap<String, String>, MappedModifiers) {
|
||||||
|
|
|
@ -91,6 +91,9 @@ pub fn launch_tasks(config_files: &Vec<Config>, tasks: &mut Vec<JoinHandle<()>>)
|
||||||
config_map.insert(window_class, config.clone());
|
config_map.insert(window_class, config.clone());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if config_map.len() > 0 && !config_map.contains_key(&"default".to_string()) {
|
||||||
|
config_map.insert("default".to_string(), Config::new_empty(device.1.name().unwrap().replace("/", "")));
|
||||||
|
}
|
||||||
let event_device = device.0.as_path().to_str().unwrap().to_string();
|
let event_device = device.0.as_path().to_str().unwrap().to_string();
|
||||||
if !config_map.is_empty() {
|
if !config_map.is_empty() {
|
||||||
let stream = Arc::new(Mutex::new(get_event_stream(Path::new(&event_device), config_map.clone())));
|
let stream = Arc::new(Mutex::new(get_event_stream(Path::new(&event_device), config_map.clone())));
|
||||||
|
|
Loading…
Add table
Reference in a new issue