feat: add master volume slider

This commit is contained in:
2026-01-24 23:45:33 +03:00
parent 5afe3dd45b
commit 4d54443593
5 changed files with 91 additions and 17 deletions
+22 -1
View File
@@ -3,7 +3,10 @@ use eframe::{App, Frame as EFrame};
use egui::{CentralPanel, Context};
use pwsp::{
types::socket::Request,
utils::{daemon::is_daemon_running, gui::make_request_sync},
utils::{
daemon::{get_daemon_config, is_daemon_running},
gui::make_request_sync,
},
};
use std::time::{Duration, Instant};
@@ -40,6 +43,24 @@ impl App for SoundpadGui {
}
}
if self.app_state.volume_dragged {
make_request_sync(Request::set_volume(
self.app_state.volume_slider_value,
None,
))
.ok();
self.app_state.volume_dragged = false;
self.app_state.ignore_volume_update_until =
Some(Instant::now() + Duration::from_millis(200));
if self.config.save_volume {
let mut daemon_config = get_daemon_config();
daemon_config.default_volume = Some(self.app_state.volume_slider_value);
daemon_config.save_to_file().ok();
}
}
{
let guard = self.audio_player_state_shared.lock().unwrap();
self.audio_player_state = guard.clone();