1
0
Fork 0
forked from wry/wry

Merge pull request #755 from mahkoh/jorth/kbvm-keysym

toml-config: use KBVM keysym parsing
This commit is contained in:
mahkoh 2026-02-24 17:28:13 +01:00 committed by GitHub
commit e1be2fb463
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 11 additions and 2590 deletions

1
Cargo.lock generated
View file

@ -721,6 +721,7 @@ dependencies = [
"error_reporter",
"indexmap",
"jay-config",
"kbvm",
"log",
"phf",
"run-on-drop",

View file

@ -20,6 +20,7 @@ bstr = { version = "1.9.1", default-features = false }
ahash = "0.8.11"
run-on-drop = "1.0.0"
uapi = "0.2.13"
kbvm = "0.1.5"
[dev-dependencies]
simplelog = { version = "0.12.2", features = ["test"] }

View file

@ -2,7 +2,6 @@ mod context;
pub mod error;
mod extractor;
mod keycodes;
mod keysyms;
mod parser;
mod parsers;
mod spanned;

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,6 @@ use {
Action, Config, Libei, Theme, UiDrag,
context::Context,
extractor::{Extractor, ExtractorError, arr, bol, int, opt, recover, str, val},
keysyms::KEYSYMS,
parser::{DataType, ParseResult, Parser, UnexpectedDataType},
parsers::{
action::ActionParser,
@ -50,6 +49,8 @@ use {
},
ahash::AHashMap,
indexmap::IndexMap,
jay_config::keyboard::syms::KeySym,
kbvm::Keysym,
std::collections::HashSet,
thiserror::Error,
};
@ -480,8 +481,8 @@ impl Parser for ConfigParser<'_> {
}
let mut pointer_revert_key = None;
if let Some(value) = pointer_revert_key_str {
match KEYSYMS.get(value.value) {
Some(s) => pointer_revert_key = Some(*s),
match Keysym::from_str(value.value) {
Some(s) => pointer_revert_key = Some(KeySym(s.0)),
None => log::warn!("Unknown keysym: {}", self.0.error3(value.span)),
}
}

View file

@ -1,9 +1,6 @@
use {
crate::{
config::{
keysyms::KEYSYMS,
parser::{DataType, ParseResult, Parser, UnexpectedDataType},
},
config::parser::{DataType, ParseResult, Parser, UnexpectedDataType},
toml::toml_span::{Span, SpannedExt},
},
jay_config::keyboard::{
@ -12,7 +9,9 @@ use {
ALT, CAPS, CTRL, LOCK, LOGO, MOD1, MOD2, MOD3, MOD4, MOD5, Modifiers, NUM, RELEASE,
SHIFT,
},
syms::KeySym,
},
kbvm::Keysym,
thiserror::Error,
};
@ -43,9 +42,9 @@ impl Parser for ModifiedKeysymParser {
for part in string.split("-") {
let modifier = match parse_mod(part) {
Some(m) => m,
_ => match KEYSYMS.get(part) {
_ => match Keysym::from_str(part) {
Some(new) if sym.is_none() => {
sym = Some(*new);
sym = Some(KeySym(new.0));
continue;
}
Some(_) => return Err(ModifiedKeysymParserError::MoreThanOneSym.spanned(span)),