Commit 21991855 authored by Jeremy Soller's avatar Jeremy Soller Committed by GitHub

Merge pull request #5 from meven/add-azerty-bepo-support

Add support for french azerty and bepo keymap
parents 83dbbe2c 8804e677
......@@ -146,3 +146,154 @@ pub mod dvorak {
}
}
}
pub mod azerty {
static AZERTY: [[char; 2]; 58] = [
['\0', '\0'],
['\x1B', '\x1B'],
['&', '1'],
['é', '2'],
['"', '3'],
['\'', '4'],
['(', '5'],
['|', '6'],
['è', '7'],
['_', '8'],
['ç', '9'],
['à', '0'],
[')', '°'],
['=', '+'],
['\x7F', '\x7F'],
['\t', '\t'],
['a', 'A'],
['z', 'Z'],
['e', 'E'],
['r', 'R'],
['t', 'T'],
['y', 'Y'],
['u', 'U'],
['i', 'I'],
['o', 'O'],
['p', 'P'],
['^', '¨'],
['$', '£'],
['\n', '\n'],
['\0', '\0'],
['q', 'Q'],
['s', 'S'],
['d', 'D'],
['f', 'F'],
['g', 'G'],
['h', 'H'],
['j', 'J'],
['k', 'K'],
['l', 'L'],
['m', 'M'],
['ù', '%'],
['*', 'µ'],
['\0', '\0'],
['ê', 'Ê'],
['w', 'W'],
['x', 'X'],
['c', 'C'],
['v', 'V'],
['b', 'B'],
['n', 'N'],
[',', '?'],
[';', '.'],
[':', '/'],
['!', '§'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
[' ', ' ']
];
pub fn get_char(scancode: u8, shift: bool) -> char {
if let Some(c) = AZERTY.get(scancode as usize) {
if shift {
c[1]
} else {
c[0]
}
} else {
'\0'
}
}
}
pub mod bepo {
static BEPO: [[char; 2]; 58] = [
['\0', '\0'],
['\x1B', '\x1B'],
['"', '1'],
['«', '2'],
['»', '3'],
['(', '4'],
[')', '5'],
['@', '6'],
['+', '7'],
['-', '8'],
['/', '9'],
['*', '0'],
['=', '°'],
['%', '`'],
['\x7F', '\x7F'],
['\t', '\t'],
['b', 'B'],
['é', 'É'],
['p', 'P'],
['o', 'O'],
['è', 'È'],
['^', '!'],
['v', 'V'],
['d', 'D'],
['l', 'L'],
['j', 'J'],
['z', 'Z'],
['w', 'W'],
['\n', '\n'],
['\0', '\0'],
['a', 'A'],
['u', 'U'],
['i', 'I'],
['e', 'E'],
[',', ';'],
['c', 'C'],
['t', 'T'],
['s', 'S'],
['r', 'R'],
['n', 'N'],
['m', 'M'],
['ç', 'Ç'],
['\0', '\0'],
['ê', 'Ê'],
['à', 'À'],
['y', 'Y'],
['x', 'X'],
['.', ':'],
['k', 'K'],
['\'', '?'],
['q', 'Q'],
['g', 'G'],
['h', 'H'],
['f', 'F'],
['\0', '\0'],
['\0', '\0'],
['\0', '\0'],
[' ', ' ']
];
pub fn get_char(scancode: u8, shift: bool) -> char {
if let Some(c) = BEPO.get(scancode as usize) {
if shift {
c[1]
} else {
c[0]
}
} else {
'\0'
}
}
}
......@@ -198,6 +198,8 @@ fn daemon(input: File) {
Some(k) => match k.to_lowercase().as_ref() {
"dvorak" => (keymap::dvorak::get_char),
"english" => (keymap::english::get_char),
"azerty" => (keymap::azerty::get_char),
"bepo" => (keymap::bepo::get_char),
&_ => (keymap::english::get_char)
},
None => (keymap::english::get_char)
......
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