-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #414 from mlouielu/add-colemak-dh-key-mappings
feat: add Colemak-DH key mapping
- Loading branch information
Showing
13 changed files
with
178 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use super::{ | ||
generic_map_keycode, | ||
KeyCode::{self, *}, | ||
KeyEvent, KeyboardLayout, Modifiers, MATRIX_SIZE, | ||
}; | ||
|
||
/// A Colemak-DH Ansiolinear keyboard. | ||
#[derive(Debug)] | ||
pub struct ColemakDhAnsi; | ||
|
||
#[rustfmt::skip] | ||
static KEYCODE_INDEX: [KeyCode; MATRIX_SIZE] = [ | ||
Unknown, | ||
N1, N2, N3, N4, N5, N6, N7, N8, N9, N0, Minus, Equal, BSlash, Grave, | ||
Q, W, F, P, B, J, L, U, Y, SColon, LBracket, RBracket, | ||
A, R, S, T, G, M, N, E, I, O, Quote, | ||
X, C, D, V, Z, K, H, Comma, Dot, Slash, Space, | ||
Esc, Enter, Del, Backspace, Tab, Left, Right, Up, Down, Home, End, | ||
PageUp, PageDown, NumLock, | ||
]; | ||
|
||
#[rustfmt::skip] | ||
static UNICODE_MAP: [char; MATRIX_SIZE] = [ | ||
'�', | ||
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\\', '`', | ||
'q', 'w', 'f', 'p', 'b', 'j', 'l', 'u', 'y', ';', '[', ']', | ||
'a', 'r', 's', 't', 'g', 'm', 'n', 'e', 'i', 'o', '\'', | ||
'x', 'c', 'd', 'v', 'z', 'k', 'h', ',', '.', '/', ' ', | ||
'�', '�', '�', '�', '�', '�', '�', '�', '�', '�', | ||
'�', '�', '�', '�', | ||
]; | ||
|
||
#[rustfmt::skip] | ||
static SHIFT_MAP: [char; MATRIX_SIZE] = [ | ||
'�', | ||
'!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '|', '~', | ||
'Q', 'W', 'F', 'P', 'B', 'J', 'L', 'U', 'Y', ':', '{', '}', | ||
'A', 'R', 'S', 'T', 'G', 'M', 'N', 'E', 'I', 'O', '"', | ||
'X', 'C', 'D', 'V', 'Z', 'K', 'H', '<', '>', '?', ' ', | ||
'�', '�', '�', '�', '�', '�', '�', '�', '�', '�', | ||
'�', '�', '�', '�', | ||
]; | ||
|
||
impl KeyboardLayout for ColemakDhAnsi { | ||
fn map_with_mod(&self, keycode: KeyCode, modifiers: Modifiers) -> KeyEvent { | ||
generic_map_keycode(&KEYCODE_INDEX, &UNICODE_MAP, &SHIFT_MAP, keycode, modifiers) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use super::{ | ||
generic_map_keycode, | ||
KeyCode::{self, *}, | ||
KeyEvent, KeyboardLayout, Modifiers, MATRIX_SIZE, | ||
}; | ||
|
||
/// A Colemak-DH Ortholinear keyboard. | ||
#[derive(Debug)] | ||
pub struct ColemakDhOrth; | ||
|
||
#[rustfmt::skip] | ||
static KEYCODE_INDEX: [KeyCode; MATRIX_SIZE] = [ | ||
Unknown, | ||
N1, N2, N3, N4, N5, N6, N7, N8, N9, N0, Minus, Equal, BSlash, Grave, | ||
Q, W, F, P, B, J, L, U, Y, SColon, LBracket, RBracket, | ||
A, R, S, T, G, M, N, E, I, O, Quote, | ||
Z, X, C, D, V, K, H, Comma, Dot, Slash, Space, | ||
Esc, Enter, Del, Backspace, Tab, Left, Right, Up, Down, Home, End, | ||
PageUp, PageDown, NumLock, | ||
]; | ||
|
||
#[rustfmt::skip] | ||
static UNICODE_MAP: [char; MATRIX_SIZE] = [ | ||
'�', | ||
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\\', '`', | ||
'q', 'w', 'f', 'p', 'b', 'j', 'l', 'u', 'y', ';', '[', ']', | ||
'a', 'r', 's', 't', 'g', 'm', 'n', 'e', 'i', 'o', '\'', | ||
'z', 'x', 'c', 'd', 'v', 'k', 'h', ',', '.', '/', ' ', | ||
'�', '�', '�', '�', '�', '�', '�', '�', '�', '�', | ||
'�', '�', '�', '�', | ||
]; | ||
|
||
#[rustfmt::skip] | ||
static SHIFT_MAP: [char; MATRIX_SIZE] = [ | ||
'�', | ||
'!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '|', '~', | ||
'Q', 'W', 'F', 'P', 'B', 'J', 'L', 'U', 'Y', ':', '{', '}', | ||
'A', 'R', 'S', 'T', 'G', 'M', 'N', 'E', 'I', 'O', '"', | ||
'Z', 'X', 'C', 'D', 'V', 'K', 'H', '<', '>', '?', ' ', | ||
'�', '�', '�', '�', '�', '�', '�', '�', '�', '�', | ||
'�', '�', '�', '�', | ||
]; | ||
|
||
impl KeyboardLayout for ColemakDhOrth { | ||
fn map_with_mod(&self, keycode: KeyCode, modifiers: Modifiers) -> KeyEvent { | ||
generic_map_keycode(&KEYCODE_INDEX, &UNICODE_MAP, &SHIFT_MAP, keycode, modifiers) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters