aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-04-26 04:01:01 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-04-26 17:06:00 +0300
commite9547a8e0de21d0ce81867b06511b68def16aff2 (patch)
tree8a025301146434b79ff295ff0d0afc833c682502 /src/client
parent3aa7903d28f94e67c14dd5cad48bbe942fbef2e9 (diff)
feat: refine live config lifecycle
Diffstat (limited to 'src/client')
-rw-r--r--src/client/mod.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs
index add890c9..19d07bfb 100644
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -43,6 +43,8 @@ struct ClientState {
last_frame: Option<FrameData>,
/// The terminal size we reported to the server in our last Hello/Resize.
reported_size: (u16, u16),
+ /// Client-local sound playback config, refreshed on server request.
+ sound_config: crate::config::SoundConfig,
}
// ---------------------------------------------------------------------------
@@ -355,6 +357,7 @@ async fn run_client_loop(
let mut state = ClientState {
last_frame: None,
reported_size: (cols, rows),
+ sound_config,
};
// Channel for events from the stdin, resize, and server reader threads.
@@ -426,12 +429,15 @@ async fn run_client_loop(
return Err(ClientError::ServerShutdown { reason });
}
ServerMessage::Notify { kind, message } => {
- handle_notify(kind, &message, &sound_config);
+ handle_notify(kind, &message, &state.sound_config);
}
ServerMessage::Clipboard { data } => {
forward_clipboard(&data);
let _ = io::stdout().flush();
}
+ ServerMessage::ReloadSoundConfig => {
+ reload_local_sound_config(&mut state.sound_config);
+ }
ServerMessage::Welcome { .. } => {
debug!("received unexpected Welcome in main loop");
}
@@ -524,6 +530,21 @@ fn write_to_server(stream: &mut UnixStream, msg: &ClientMessage) -> io::Result<(
// Notifications
// ---------------------------------------------------------------------------
+fn reload_local_sound_config(sound_config: &mut crate::config::SoundConfig) {
+ match crate::config::load_live_config() {
+ Ok(loaded) => {
+ for diagnostic in loaded.config.ui.sound.diagnostics() {
+ warn!(diagnostic = %diagnostic, "local sound config diagnostic");
+ }
+ *sound_config = loaded.config.ui.sound;
+ debug!("reloaded local sound config");
+ }
+ Err(diagnostics) => {
+ warn!(diagnostics = ?diagnostics, "failed to reload local sound config; keeping current sound config");
+ }
+ }
+}
+
fn handle_notify(kind: NotifyKind, message: &str, sound_config: &crate::config::SoundConfig) {
handle_notify_with_terminal_notifier(
kind,