core: layout: add hardcoded greekmath layout

Add the built-in layout for Greek and math characters.
This commit is contained in:
Richard Acayan 2024-10-31 18:30:35 -04:00
parent 4a55205202
commit ab035f1b2c
No known key found for this signature in database
GPG key ID: 0346F4894879DB73
2 changed files with 14 additions and 0 deletions

View file

@ -96,6 +96,8 @@ Layouts are essential and not installed by cargo. They are installed manually:
$ sudo mv bottom_row.xml /usr/share/unfettered-keyboard/layouts $ sudo mv bottom_row.xml /usr/share/unfettered-keyboard/layouts
$ curl -OL https://github.com/Julow/Unexpected-Keyboard/raw/1.29.1/res/xml/numeric.xml $ curl -OL https://github.com/Julow/Unexpected-Keyboard/raw/1.29.1/res/xml/numeric.xml
$ sudo mv numeric.xml /usr/share/unfettered-keyboard/layouts $ sudo mv numeric.xml /usr/share/unfettered-keyboard/layouts
$ curl -OL https://github.com/Julow/Unexpected-Keyboard/raw/1.29.1/res/xml/greekmath.xml
$ sudo mv numeric.xml /usr/share/unfettered-keyboard/layouts
# Configuration # Configuration

View file

@ -611,6 +611,7 @@ impl LayoutFile {
pub struct Layout { pub struct Layout {
main_layout: LayoutFile, main_layout: LayoutFile,
numeric: LayoutFile, numeric: LayoutFile,
greekmath: LayoutFile,
bottom_row: LayoutFile, bottom_row: LayoutFile,
rows: Vec<Vec<Key>>, rows: Vec<Vec<Key>>,
@ -700,12 +701,16 @@ impl Layout {
let path = dir.join("numeric.xml"); let path = dir.join("numeric.xml");
let numeric = LayoutFile::load(path)?; let numeric = LayoutFile::load(path)?;
let path = dir.join("greekmath.xml");
let greekmath = LayoutFile::load(path)?;
let path = dir.join("bottom_row.xml"); let path = dir.join("bottom_row.xml");
let bottom_row = LayoutFile::load(path)?; let bottom_row = LayoutFile::load(path)?;
let mut layout = Layout { let mut layout = Layout {
main_layout, main_layout,
numeric, numeric,
greekmath,
bottom_row, bottom_row,
rows: Vec::new(), rows: Vec::new(),
@ -818,6 +823,13 @@ impl Layout {
self.set_text_supported(self.text_supp); self.set_text_supported(self.text_supp);
} }
pub fn switch_greekmath(&mut self)
{
let data = self.greekmath.clone();
self.open_layout(data);
self.set_text_supported(self.text_supp);
}
pub fn switch_text(&mut self) pub fn switch_text(&mut self)
{ {
let data = self.main_layout.clone(); let data = self.main_layout.clone();