diff --git a/README.md b/README.md index 954811a..7b30b37 100644 --- a/README.md +++ b/README.md @@ -110,3 +110,4 @@ Configuration example: wayland: height: 185 + input-method: true diff --git a/src/core/config.rs b/src/core/config.rs index 853f53f..42c8832 100644 --- a/src/core/config.rs +++ b/src/core/config.rs @@ -16,6 +16,7 @@ pub struct Configuration { repeat: u64, layout: String, wayland_height: i32, + wayland_im_enable: bool, } impl Configuration { @@ -30,6 +31,13 @@ impl Configuration { let height = height.expect("Wayland height should be a 32-bit signed integer"); self.wayland_height = height; } + + let im_enable = yaml.get(&Yaml::String(String::from("input-method"))); + if let Some(im_enable) = im_enable { + let im_enable = im_enable.as_bool(); + let im_enable = im_enable.expect("Wayland height should be a 32-bit signed integer"); + self.wayland_im_enable = im_enable; + } } pub fn load() -> Result @@ -39,6 +47,7 @@ impl Configuration { repeat: 25, layout: String::from("latn_qwerty_us.xml"), wayland_height: 185, + wayland_im_enable: true, }; if let Ok(file) = File::open("/etc/unfettered-keyboard.yaml") { @@ -106,4 +115,10 @@ impl Configuration { { self.wayland_height } + + #[inline(always)] + pub fn wayland_im_enable(&self) -> bool + { + self.wayland_im_enable + } }