From 3e36cc551f704859302631203a9949bcda12c1a2 Mon Sep 17 00:00:00 2001 From: 4yn <4yn@users.noreply.github.com> Date: Sun, 26 Jun 2022 01:04:24 +0800 Subject: [PATCH] add umiguri keyboard layout --- src-slider_io/src/output/config.rs | 6 ++++++ src-slider_io/src/output/keyboard.rs | 12 ++++++++++++ src/App.svelte | 2 ++ 3 files changed, 20 insertions(+) diff --git a/src-slider_io/src/output/config.rs b/src-slider_io/src/output/config.rs index cc504f9..81f330b 100644 --- a/src-slider_io/src/output/config.rs +++ b/src-slider_io/src/output/config.rs @@ -13,6 +13,7 @@ pub enum PollingRate { pub enum KeyboardLayout { Tasoller, Yuancon, + Umiguri, TasollerHalf, EightK, SixK, @@ -94,6 +95,11 @@ impl OutputMode { polling: PollingRate::from_str(v["outputPolling"].as_str()?)?, sensitivity: u8::try_from(v["keyboardSensitivity"].as_i64()?).ok()?, }, + "kb-32-umiguri" => OutputMode::Keyboard { + layout: KeyboardLayout::Umiguri, + polling: PollingRate::from_str(v["outputPolling"].as_str()?)?, + sensitivity: u8::try_from(v["keyboardSensitivity"].as_i64()?).ok()?, + }, "kb-16" => OutputMode::Keyboard { layout: KeyboardLayout::TasollerHalf, polling: PollingRate::from_str(v["outputPolling"].as_str()?)?, diff --git a/src-slider_io/src/output/keyboard.rs b/src-slider_io/src/output/keyboard.rs index 97b4b4c..a5cb0b3 100644 --- a/src-slider_io/src/output/keyboard.rs +++ b/src-slider_io/src/output/keyboard.rs @@ -31,6 +31,17 @@ const YUANCON_KB_MAP: [usize; 41] = [ 0x0d, 0x20, 0x1b, // VK_RETURN, VK_SPACE, VK_ESCAPE ]; +#[rustfmt::skip] +const UMIGURI_KB_MAP: [usize; 41] = [ + 0x41 /* A */, 0x31 /* 1 */, 0x5a /* Z */, 0x51 /* Q */, 0x53 /* S */, 0x32 /* 2 */, 0x58 /* X */, 0x57 /* W */, + 0x44 /* D */, 0x33 /* 3 */, 0x43 /* C */, 0x45 /* E */, 0x46 /* F */, 0x34 /* 4 */, 0x56 /* V */, 0x52 /* R */, + 0x47 /* G */, 0x35 /* 5 */, 0x42 /* B */, 0x54 /* T */, 0x48 /* H */, 0x36 /* 6 */, 0x4e /* N */, 0x59 /* Y */, + 0x4a /* J */, 0x37 /* 7 */, 0x4d /* M */, 0x55 /* U */, 0x4b /* K */, 0x38 /* 8 */, 0xbc /* VK_OEM_COMMA */, 0x49 /* I */, + 0x30, 0x4f, 0x4c, // 0, O, L + 0x50, 0xbc, 0xbe, // P, VK_OEM_COMMA, VK_OEM_PERIOD, + 0x0d, 0x20, 0x1b // VK_RETURN, VK_SPACE, VK_ESCAPE +]; + #[rustfmt::skip] const TASOLLER_HALF_KB_MAP: [usize; 41] = [ 0x41, 0x41 /* A */, 0x5a, 0x5a /* Z */, 0x53, 0x53 /* S */, 0x58, 0x58 /* X */, @@ -130,6 +141,7 @@ impl KeyboardOutput { let kb_map = match layout { KeyboardLayout::Tasoller => &TASOLLER_KB_MAP, KeyboardLayout::Yuancon => &YUANCON_KB_MAP, + KeyboardLayout::Umiguri => &UMIGURI_KB_MAP, KeyboardLayout::TasollerHalf => &TASOLLER_HALF_KB_MAP, KeyboardLayout::EightK => &EIGHT_K_MAP, KeyboardLayout::SixK => &SIX_K_MAP, diff --git a/src/App.svelte b/src/App.svelte index 49ee3c1..577ddf7 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -296,6 +296,8 @@ > +