From 1819dabbc4f1e76b6777bf81cab214b981139b9d Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Thu, 14 Mar 2024 13:53:01 +0100 Subject: [PATCH] Improve default config now includes media control keys --- src/config.rs | 50 +++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/src/config.rs b/src/config.rs index 798f820..f1a2d32 100644 --- a/src/config.rs +++ b/src/config.rs @@ -16,30 +16,42 @@ pub fn init(path: PathBuf) -> Config { } fn serialize_default() -> Result { - let mut mpris = BTreeMap::new(); let mut keymap = BTreeMap::new(); - keymap.insert( - NanoKeys::Param4Mute, - vec![ - KeyMapVariant::Mpris { - ids: Option::Some(vec!["Feishin".to_string()]), - action: MprisAction::PlayPause, - }, - KeyMapVariant::PipeWire { - ids: vec![ - "alsa_output.usb-0d8c_Generic_USB_Audio_Device-00.iec958-stereo".to_string(), - ], - }, - ], - ); keymap.insert( NanoKeys::Play, - vec![KeyMapVariant::Exec { - command: "echo hello".to_string(), - args: Option::None, + vec![KeyMapVariant::Mpris { + ids: Option::None, + action: MprisAction::PlayPause, + }], + ); + keymap.insert( + NanoKeys::Stop, + vec![KeyMapVariant::Mpris { + ids: Option::None, + action: MprisAction::Stop, + }], + ); + keymap.insert( + NanoKeys::Next, + vec![KeyMapVariant::Mpris { + ids: Option::None, + action: MprisAction::Next, + }], + ); + keymap.insert( + NanoKeys::Prev, + vec![KeyMapVariant::Mpris { + ids: Option::None, + action: MprisAction::Previous, + }], + ); + keymap.insert( + NanoKeys::Param1Slider, + vec![KeyMapVariant::Mpris { + ids: Option::Some(vec!["Feishin".to_string()]), + action: MprisAction::Volume, }], ); - mpris.insert("music".to_string(), "Feishin".to_string()); let conf: Config = Config { general: General { midi_device: "nanoKONTROL2".to_string(),