From b4dd6a8989d7ceedc6f73e9c3363fe0773a7a743 Mon Sep 17 00:00:00 2001 From: cyber-sushi Date: Wed, 29 May 2024 06:04:38 +0200 Subject: [PATCH] Associated application and layout is now stored inside Config struct --- src/config.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/config.rs b/src/config.rs index 5094469..e07ee90 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,6 +1,7 @@ use std::{collections::HashMap, str::FromStr}; use evdev::Key; use serde; +use crate::udev_monitor::Client; #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] @@ -60,6 +61,12 @@ impl FromStr for Axis { } } +#[derive(Debug, PartialEq, Eq, Default, Clone)] +pub struct Associations { + pub client: Client, + pub layout: u16, +} + #[derive(Default, Debug, Clone)] pub struct Bindings { pub remap: HashMap, Vec>>, @@ -103,6 +110,7 @@ impl RawConfig { #[derive(Debug, Clone)] pub struct Config { pub name: String, + pub associations: Associations, pub bindings: Bindings, pub settings: HashMap, pub mapped_modifiers: MappedModifiers, @@ -112,9 +120,11 @@ impl Config { pub fn new_from_file(file: &str, file_name: String) -> Self { let raw_config = RawConfig::new_from_file(file); let (bindings, settings, mapped_modifiers) = parse_raw_config(raw_config); + let associations = Default::default(); Self { name: file_name, + associations, bindings, settings, mapped_modifiers, @@ -124,6 +134,7 @@ impl Config { pub fn new_empty(file_name: String) -> Self { Self { name: file_name, + associations: Default::default(), bindings: Default::default(), settings: Default::default(), mapped_modifiers: Default::default(),