Commit 38cea07d authored by Jeremy Soller's avatar Jeremy Soller Committed by GitHub

Merge pull request #11 from kaedroho/feature/gb-keymap

Add GB keymap
parents 466c776b bc1efaeb
pub mod english {
static ENGLISH: [[char; 2]; 58] = [
pub mod us {
static US: [[char; 2]; 58] = [
['\0', '\0'],
['\x1B', '\x1B'],
['1', '!'],
......@@ -61,7 +61,7 @@ pub mod english {
];
pub fn get_char(scancode: u8, shift: bool) -> char {
if let Some(c) = ENGLISH.get(scancode as usize) {
if let Some(c) = US.get(scancode as usize) {
if shift {
c[1]
} else {
......@@ -72,6 +72,111 @@ pub mod english {
}
}
}
pub mod gb {
static GB: [[char; 2]; 58] = [
['\0', '\0'],
['\x1B', '\x1B'],
['1', '!'],
['2', '"'],
['3', '£'],
['4', '$'],
['5', '%'],
['6', '^'],
['7', '&'],
['8', '*'],
['9', '('],
['0', ')'],
['-', '_'],
['=', '+'],
['\x7F', '\x7F'],
['\t', '\t'],
['q', 'Q'],
['w', 'W'],
['e', 'E'],
['r', 'R'],
['t', 'T'],
['y', 'Y'],
['u', 'U'],
['i', 'I'],
['o', 'O'],
['p', 'P'],
['[', '{'],
[']', '}'],
['\n', '\n'],
['\0', '\0'],
['a', 'A'],
['s', 'S'],
['d', 'D'],
['f', 'F'],
['g', 'G'],
['h', 'H'],
['j', 'J'],
['k', 'K'],
['l', 'L'],
[';', ':'],
['\'', '@'],
['`', '¬'],
['\0', '\0'],
['#', '~'],
['z', 'Z'],
['x', 'X'],
['c', 'C'],
['v', 'V'],
['b', 'B'],
['n', 'N'],
['m', 'M'],
[',', '<'],
['.', '>'],
['/', '?'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
[' ', ' ']
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
['\\', '|'],
];
pub fn get_char(scancode: u8, shift: bool) -> char {
if let Some(c) = GB.get(scancode as usize) {
if shift {
c[1]
} else {
c[0]
}
} else {
'\0'
}
}
}
pub mod dvorak {
static DVORAK: [[char; 2]; 58] = [
['\0', '\0'],
......@@ -296,4 +401,3 @@ pub mod bepo {
}
}
}
......@@ -197,12 +197,13 @@ fn daemon(input: File) {
let keymap = match env::args().skip(1).next() {
Some(k) => match k.to_lowercase().as_ref() {
"dvorak" => (keymap::dvorak::get_char),
"english" => (keymap::english::get_char),
"us" => (keymap::us::get_char),
"gb" => (keymap::gb::get_char),
"azerty" => (keymap::azerty::get_char),
"bepo" => (keymap::bepo::get_char),
&_ => (keymap::english::get_char)
&_ => (keymap::us::get_char)
},
None => (keymap::english::get_char)
None => (keymap::us::get_char)
};
let ps2d = Arc::new(RefCell::new(Ps2d::new(input, keymap)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment