aboutsummaryrefslogtreecommitdiffstats
path: root/src/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/parser.rs b/src/parser.rs
index fe56fca..8314e0d 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -203,6 +203,58 @@ impl MapGroup {
}
}
+/// Default headphone button mappings:
+///
+/// * Up → Volume up
+/// * Middle → Play
+/// * Down → Volume down
+impl Default for MapGroup {
+ fn default() -> Self {
+ let mut default_maps: MapCollection = HashMap::new();
+ default_maps.insert(
+ vec![HeadphoneButton::Up],
+ MapAction {
+ action: Action::Map(
+ vec![KeyboardKeyWithModifiers::new(
+ KeyboardKey::NXKey(key_code::NX_KEYTYPE_SOUND_UP),
+ vec![],
+ )]
+ ),
+ kind: MapKind::Map,
+ },
+ );
+ default_maps.insert(
+ vec![HeadphoneButton::Play],
+ MapAction {
+ action: Action::Map(
+ vec![KeyboardKeyWithModifiers::new(
+ KeyboardKey::NXKey(key_code::NX_KEYTYPE_PLAY),
+ vec![],
+ )]
+ ),
+ kind: MapKind::Map,
+ },
+ );
+ default_maps.insert(
+ vec![HeadphoneButton::Down],
+ MapAction {
+ action: Action::Map(
+ vec![KeyboardKeyWithModifiers::new(
+ KeyboardKey::NXKey(key_code::NX_KEYTYPE_SOUND_DOWN),
+ vec![],
+ )]
+ ),
+ kind: MapKind::Map,
+ },
+ );
+
+ MapGroup {
+ maps: default_maps,
+ modes: HashMap::new(),
+ }
+ }
+}
+
fn string_case_insensitive<I>(
s: &'static str