Compare commits
10 Commits
v1.4.0
...
squeekboar
| Author | SHA1 | Date | |
|---|---|---|---|
| 3af10285b7 | |||
| 53997abc46 | |||
| 34765be22e | |||
| 8b4c643d3e | |||
| 358b25c431 | |||
| 2749fdb686 | |||
| 8e7909e877 | |||
| afaacd3f68 | |||
| 3c45e3e53c | |||
| 3ac4caa3b9 |
@ -4,6 +4,7 @@ version = "0.1.0"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "1.0.*"
|
bitflags = "1.0.*"
|
||||||
|
clap = "2.32.*"
|
||||||
maplit = "1.0.*"
|
maplit = "1.0.*"
|
||||||
regex = "1.1.*"
|
regex = "1.1.*"
|
||||||
serde = { version = "1.0.*", features = ["derive"] }
|
serde = { version = "1.0.*", features = ["derive"] }
|
||||||
|
|||||||
88
data/keyboards/de_wide.yaml
Normal file
88
data/keyboards/de_wide.yaml
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
# Maintained by: Mark Müller <markmueller86@gmail.com>
|
||||||
|
---
|
||||||
|
bounds: { x: 0, y: 1, width: 540, height: 168 }
|
||||||
|
|
||||||
|
outlines:
|
||||||
|
default:
|
||||||
|
bounds: { x: 0, y: 0, width: 48, height: 42 }
|
||||||
|
altline:
|
||||||
|
bounds: { x: 0, y: 0, width: 81, height: 42 }
|
||||||
|
wide:
|
||||||
|
bounds: { x: 0, y: 0, width: 108, height: 42 }
|
||||||
|
spaceline:
|
||||||
|
bounds: { x: 0, y: 0, width: 216, height: 42 }
|
||||||
|
special:
|
||||||
|
bounds: { x: 0, y: 0, width: 48, height: 42 }
|
||||||
|
|
||||||
|
views:
|
||||||
|
base:
|
||||||
|
- "q w e r t z u i o p ü"
|
||||||
|
- "a s d f g h j k l ö ä"
|
||||||
|
- "Shift_L y x c v b n m BackSpace"
|
||||||
|
- "show_numbers preferences space , . Return"
|
||||||
|
upper:
|
||||||
|
- "Q W E R T Z U I O P Ü"
|
||||||
|
- "A S D F G H J K L Ö Ä"
|
||||||
|
- "Shift_L Y X C V B N M BackSpace"
|
||||||
|
- "show_numbers preferences space ! ? Return"
|
||||||
|
numbers:
|
||||||
|
- "1 2 3 4 5 6 7 8 9 0"
|
||||||
|
- "@ # % & - _ + ( ) ß"
|
||||||
|
- "show_symbols , \" ' : = < > BackSpace"
|
||||||
|
- "show_letters preferences space , . Return"
|
||||||
|
symbols:
|
||||||
|
- "~ ` ´ · © ® ÷ × ¶"
|
||||||
|
- "€ £ $ ¥ ^ ° * { } |"
|
||||||
|
- "show_numbers \\ / § π τ [ ] BackSpace"
|
||||||
|
- "show_letters preferences space , . Return"
|
||||||
|
eschars:
|
||||||
|
- "ä è é ö ü Ä È É Ö Ü"
|
||||||
|
- "à â ê î ô À Â È Î Ô"
|
||||||
|
- "show_numbers « » ç Ç æ œ ß BackSpace"
|
||||||
|
- "show_letters preferences space „ “ Return"
|
||||||
|
|
||||||
|
buttons:
|
||||||
|
Shift_L:
|
||||||
|
action:
|
||||||
|
locking:
|
||||||
|
lock_view: "upper"
|
||||||
|
unlock_view: "base"
|
||||||
|
outline: "altline"
|
||||||
|
icon: "key-shift"
|
||||||
|
BackSpace:
|
||||||
|
outline: "altline"
|
||||||
|
icon: "edit-clear-symbolic"
|
||||||
|
keysym: "BackSpace"
|
||||||
|
preferences:
|
||||||
|
action: "show_prefs"
|
||||||
|
outline: "special"
|
||||||
|
icon: "keyboard-mode-symbolic"
|
||||||
|
show_numbers:
|
||||||
|
action:
|
||||||
|
set_view: "numbers"
|
||||||
|
outline: "altline"
|
||||||
|
label: "123"
|
||||||
|
show_letters:
|
||||||
|
action:
|
||||||
|
set_view: "base"
|
||||||
|
outline: "altline"
|
||||||
|
label: "abc"
|
||||||
|
show_symbols:
|
||||||
|
action:
|
||||||
|
set_view: "symbols"
|
||||||
|
outline: "altline"
|
||||||
|
label: "*/="
|
||||||
|
show_eschars:
|
||||||
|
action:
|
||||||
|
locking:
|
||||||
|
lock_view: "eschars"
|
||||||
|
unlock_view: "base"
|
||||||
|
outline: "altline"
|
||||||
|
label: "äÄ"
|
||||||
|
space:
|
||||||
|
outline: "spaceline"
|
||||||
|
text: " "
|
||||||
|
Return:
|
||||||
|
outline: "altline"
|
||||||
|
icon: "key-enter"
|
||||||
|
keysym: "Return"
|
||||||
1
debian/control
vendored
1
debian/control
vendored
@ -12,6 +12,7 @@ Build-Depends:
|
|||||||
libgtk-3-dev,
|
libgtk-3-dev,
|
||||||
libcroco3-dev,
|
libcroco3-dev,
|
||||||
librust-bitflags-1-dev (>= 1.0),
|
librust-bitflags-1-dev (>= 1.0),
|
||||||
|
librust-clap-2+default-dev (>= 2.32),
|
||||||
librust-gio+v2-44-dev,
|
librust-gio+v2-44-dev,
|
||||||
librust-glib+v2-44-dev,
|
librust-glib+v2-44-dev,
|
||||||
librust-glib-sys-dev,
|
librust-glib-sys-dev,
|
||||||
|
|||||||
@ -1,8 +1,16 @@
|
|||||||
|
#[macro_use]
|
||||||
|
extern crate clap;
|
||||||
extern crate rs;
|
extern crate rs;
|
||||||
|
|
||||||
use rs::tests::check_layout_file;
|
use rs::tests::check_layout_file;
|
||||||
use std::env;
|
|
||||||
|
|
||||||
fn main() -> () {
|
fn main() -> () {
|
||||||
check_layout_file(env::args().nth(1).expect("No argument given").as_str());
|
let matches = clap_app!(test_layout =>
|
||||||
|
(name: "squeekboard-test-layout")
|
||||||
|
(about: "Test keyboard layout for errors. Returns OK or an error message containing further information.")
|
||||||
|
(@arg INPUT: +required "Yaml keyboard layout file to test")
|
||||||
|
).get_matches();
|
||||||
|
if check_layout_file(matches.value_of("INPUT").unwrap()) == () {
|
||||||
|
println!("Test result: OK");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,6 +51,15 @@ pub struct KeyState {
|
|||||||
pub action: Action,
|
pub action: Action,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sorts an iterator by converting it to a Vector and back
|
||||||
|
fn sorted<'a, I: Iterator<Item=&'a str>>(
|
||||||
|
iter: I
|
||||||
|
) -> impl Iterator<Item=&'a str> {
|
||||||
|
let mut v: Vec<&'a str> = iter.collect();
|
||||||
|
v.sort();
|
||||||
|
v.into_iter()
|
||||||
|
}
|
||||||
|
|
||||||
/// Generates a mapping where each key gets a keycode, starting from ~~8~~
|
/// Generates a mapping where each key gets a keycode, starting from ~~8~~
|
||||||
/// HACK: starting from 9, because 8 results in keycode 0,
|
/// HACK: starting from 9, because 8 results in keycode 0,
|
||||||
/// which the compositor likes to discard
|
/// which the compositor likes to discard
|
||||||
@ -58,7 +67,8 @@ pub fn generate_keycodes<'a, C: IntoIterator<Item=&'a str>>(
|
|||||||
key_names: C
|
key_names: C
|
||||||
) -> HashMap<String, u32> {
|
) -> HashMap<String, u32> {
|
||||||
HashMap::from_iter(
|
HashMap::from_iter(
|
||||||
key_names.into_iter()
|
// sort to remove a source of indeterminism in keycode assignment
|
||||||
|
sorted(key_names.into_iter())
|
||||||
.map(|name| String::from(name))
|
.map(|name| String::from(name))
|
||||||
.zip(9..)
|
.zip(9..)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -7,9 +7,9 @@ use ::locale::compare_current_locale;
|
|||||||
use ::locale_config::system_locale;
|
use ::locale_config::system_locale;
|
||||||
use ::resources;
|
use ::resources;
|
||||||
|
|
||||||
use gio::ActionExt;
|
|
||||||
use gio::ActionMapExt;
|
use gio::ActionMapExt;
|
||||||
use gio::SettingsExt;
|
use gio::SettingsExt;
|
||||||
|
use gio::SimpleActionExt;
|
||||||
use glib::translate::FromGlibPtrNone;
|
use glib::translate::FromGlibPtrNone;
|
||||||
use glib::variant::ToVariant;
|
use glib::variant::ToVariant;
|
||||||
use gtk::PopoverExt;
|
use gtk::PopoverExt;
|
||||||
@ -195,7 +195,7 @@ pub fn show(window: EekGtkKeyboard, position: ::layout::c::Bounds) {
|
|||||||
height: position.width.floor() as i32,
|
height: position.width.floor() as i32,
|
||||||
});
|
});
|
||||||
|
|
||||||
let action = input_names.get(0).map(|current_name| {
|
if let Some(current_name) = input_names.get(0) {
|
||||||
let current_name = current_name.to_variant();
|
let current_name = current_name.to_variant();
|
||||||
|
|
||||||
let layout_action = gio::SimpleAction::new_stateful(
|
let layout_action = gio::SimpleAction::new_stateful(
|
||||||
@ -204,36 +204,26 @@ pub fn show(window: EekGtkKeyboard, position: ::layout::c::Bounds) {
|
|||||||
¤t_name,
|
¤t_name,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
layout_action.connect_change_state(|_action, state| {
|
||||||
|
match state {
|
||||||
|
Some(v) => {
|
||||||
|
v.get::<String>()
|
||||||
|
.or_else(|| {
|
||||||
|
eprintln!("Variant is not string: {:?}", v);
|
||||||
|
None
|
||||||
|
})
|
||||||
|
.map(|state| set_layout("xkb".into(), state));
|
||||||
|
},
|
||||||
|
None => eprintln!("No variant selected"),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
let action_group = gio::SimpleActionGroup::new();
|
let action_group = gio::SimpleActionGroup::new();
|
||||||
action_group.add_action(&layout_action);
|
action_group.add_action(&layout_action);
|
||||||
|
|
||||||
menu.insert_action_group("popup", Some(&action_group));
|
menu.insert_action_group("popup", Some(&action_group));
|
||||||
layout_action
|
};
|
||||||
});
|
|
||||||
|
|
||||||
menu.bind_model(Some(&model), Some("popup"));
|
menu.bind_model(Some(&model), Some("popup"));
|
||||||
|
|
||||||
menu.connect_closed(move |_menu| {
|
|
||||||
if let Some(layout_action) = &action {
|
|
||||||
let state = match layout_action.get_state() {
|
|
||||||
Some(v) => {
|
|
||||||
let s = v.get::<String>().or_else(|| {
|
|
||||||
eprintln!("Variant is not string: {:?}", v);
|
|
||||||
None
|
|
||||||
});
|
|
||||||
// FIXME: the `get_state` docs call for unrefing,
|
|
||||||
// but the function is nowhere to be found
|
|
||||||
// glib::Variant::unref(v);
|
|
||||||
s
|
|
||||||
},
|
|
||||||
None => {
|
|
||||||
eprintln!("No variant selected");
|
|
||||||
None
|
|
||||||
},
|
|
||||||
};
|
|
||||||
set_layout("xkb".into(), state.unwrap_or("us".into()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
menu.popup();
|
menu.popup();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const KEYBOARDS: &[(*const str, *const str)] = &[
|
|||||||
("us", include_str!("../data/keyboards/us.yaml")),
|
("us", include_str!("../data/keyboards/us.yaml")),
|
||||||
("us_wide", include_str!("../data/keyboards/us_wide.yaml")),
|
("us_wide", include_str!("../data/keyboards/us_wide.yaml")),
|
||||||
("de", include_str!("../data/keyboards/de.yaml")),
|
("de", include_str!("../data/keyboards/de.yaml")),
|
||||||
|
("de_wide", include_str!("../data/keyboards/de_wide.yaml")),
|
||||||
("el", include_str!("../data/keyboards/el.yaml")),
|
("el", include_str!("../data/keyboards/el.yaml")),
|
||||||
("es", include_str!("../data/keyboards/es.yaml")),
|
("es", include_str!("../data/keyboards/es.yaml")),
|
||||||
("fi", include_str!("../data/keyboards/fi.yaml")),
|
("fi", include_str!("../data/keyboards/fi.yaml")),
|
||||||
|
|||||||
@ -49,7 +49,7 @@ endforeach
|
|||||||
# and the need to call it manually
|
# and the need to call it manually
|
||||||
foreach layout : [
|
foreach layout : [
|
||||||
'us', 'us_wide',
|
'us', 'us_wide',
|
||||||
'de',
|
'de', 'de_wide',
|
||||||
'el',
|
'el',
|
||||||
'es',
|
'es',
|
||||||
'fi',
|
'fi',
|
||||||
|
|||||||
Reference in New Issue
Block a user