Add audio controls and focused hotkeys

This commit is contained in:
2026-06-16 17:23:38 -04:00
parent 22f0eed94d
commit 20643a24de
12 changed files with 1341 additions and 59 deletions
+27 -1
View File
@@ -1,6 +1,7 @@
use crate::notify::Sound;
use crate::theme::AppTheme;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::fs;
use std::path::PathBuf;
@@ -232,6 +233,17 @@ pub struct AppConfig {
/// capped (see `recents`). Defaulted empty so older configs upgrade cleanly.
#[serde(default)]
pub recents: Vec<crate::recents::Recent>,
/// Per-peer listener-side EQ settings, keyed by peer node id string. Local
/// preference only; never sent to peers.
#[serde(default)]
pub peer_eq: HashMap<String, crate::audio::eq::EqSettings>,
/// Per-peer listener-side pan (`-1.0` left, `0.0` center, `1.0` right),
/// keyed by peer node id string. Local preference only.
#[serde(default)]
pub peer_pan: HashMap<String, f32>,
/// Focused app-local keyboard shortcuts.
#[serde(default)]
pub hotkeys: crate::hotkeys::HotkeyMap,
/// Last window size (px), restored as the initial size on next launch.
/// Saved on close.
#[serde(default = "default_window_width")]
@@ -287,6 +299,9 @@ impl Default for AppConfig {
sound_reconnect_failed_enabled: true,
pixelpass_path: None,
recents: Vec::new(),
peer_eq: HashMap::new(),
peer_pan: HashMap::new(),
hotkeys: crate::hotkeys::HotkeyMap::default(),
window_width: default_window_width(),
window_height: default_window_height(),
window_x: None,
@@ -411,6 +426,18 @@ mod tests {
assert_eq!(deserialized.window_height, 760.0);
// Configs predating the recents list load an empty list.
assert!(deserialized.recents.is_empty());
// Configs predating per-peer listener shaping load flat/center/default
// shortcut settings.
assert!(deserialized.peer_eq.is_empty());
assert!(deserialized.peer_pan.is_empty());
assert_eq!(
crate::hotkeys::format_binding(
deserialized
.hotkeys
.binding(crate::hotkeys::HotkeyAction::PushToTalk)
),
"Space"
);
}
#[test]
@@ -596,4 +623,3 @@ mod tests {
assert_eq!(config.noise_gate_threshold, 0.01);
}
}