aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-12-05 08:04:46 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-12-05 08:04:46 +0400
commit11ae17b220dfb454c524fff800f97bc11c3a56dd (patch)
tree591bf0bb2c729a268ffd9a75c5471ec2a9b86dea /src/config.rs
parent40b633be5c100a592ba9186777ff4f495f895131 (diff)
downloadniri-11ae17b220dfb454c524fff800f97bc11c3a56dd.tar.gz
niri-11ae17b220dfb454c524fff800f97bc11c3a56dd.tar.bz2
niri-11ae17b220dfb454c524fff800f97bc11c3a56dd.zip
Extract to_xkb_config() to a method
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/config.rs b/src/config.rs
index a76bf348..966fd85b 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -6,7 +6,7 @@ use directories::ProjectDirs;
use miette::{miette, Context, IntoDiagnostic};
use smithay::input::keyboard::keysyms::KEY_NoSymbol;
use smithay::input::keyboard::xkb::{keysym_from_name, KEYSYM_CASE_INSENSITIVE};
-use smithay::input::keyboard::Keysym;
+use smithay::input::keyboard::{Keysym, XkbConfig};
#[derive(knuffel::Decode, Debug, PartialEq)]
pub struct Config {
@@ -80,6 +80,18 @@ pub struct Xkb {
pub options: Option<String>,
}
+impl Xkb {
+ pub fn to_xkb_config(&self) -> XkbConfig {
+ XkbConfig {
+ rules: &self.rules,
+ model: &self.model,
+ layout: self.layout.as_deref().unwrap_or("us"),
+ variant: &self.variant,
+ options: self.options.clone(),
+ }
+ }
+}
+
#[derive(knuffel::DecodeScalar, Debug, Default, PartialEq, Eq)]
pub enum TrackLayout {
/// The layout change is global.