diff --git a/src/server/audio_service.rs b/src/server/audio_service.rs index e61ebbc16..e7658e886 100644 --- a/src/server/audio_service.rs +++ b/src/server/audio_service.rs @@ -171,9 +171,6 @@ mod cpal_impl { } fn get_audio_input(audio_input: &str) -> ResultType<(Device, SupportedStreamConfig)> { - if audio_input == "Mute" { - bail!("Mute"); - } let mut device = None; if !audio_input.is_empty() { for d in HOST diff --git a/src/server/connection.rs b/src/server/connection.rs index 8b46978a4..32d489140 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -137,7 +137,7 @@ impl Connection { authorized: false, keyboard: Config::get_option("enable-keyboard").is_empty(), clipboard: Config::get_option("enable-clipboard").is_empty(), - audio: Config::get_option("audio-input") != "Mute", + audio: Config::get_option("enable-audio").is_empty(), file: Config::get_option("enable-file-transfer").is_empty(), last_test_delay: 0, image_quality: ImageQuality::Balanced.value(), diff --git a/src/ui/cm.rs b/src/ui/cm.rs index 92dc94f14..fca0a0205 100644 --- a/src/ui/cm.rs +++ b/src/ui/cm.rs @@ -191,14 +191,14 @@ impl ConnectionManager { } } }, + #[cfg(windows)] Data::ClipbaordFile(_clip) => { - #[cfg(windows)] _tx_clip_file .send(ClipboardFileData::Clip((id, _clip))) .ok(); } + #[cfg(windows)] Data::ClipboardFileEnabled(enabled) => { - #[cfg(windows)] _tx_clip_file .send(ClipboardFileData::Enable((id, enabled))) .ok(); @@ -342,6 +342,7 @@ impl sciter::EventHandler for ConnectionManager { } enum ClipboardFileData { + #[cfg(windows)] Clip((i32, ipc::ClipbaordFile)), Enable((i32, bool)), } @@ -436,10 +437,6 @@ async fn start_pa() { { device = x; } - if device == "Mute" { - log::info!("Switch mute mode, skip sample audio."); - continue; - } if !device.is_empty() { device = crate::platform::linux::get_pa_source_name(&device); } diff --git a/src/ui/index.tis b/src/ui/index.tis index a2cea681d..add5acd94 100644 --- a/src/ui/index.tis +++ b/src/ui/index.tis @@ -97,11 +97,12 @@ class AudioInputs: Reactor.Component { var inputs = handler.get_sound_inputs(); if (is_win) inputs = ["System Sound"].concat(inputs); if (!inputs.length) return
  • ; - inputs = ["Mute"].concat(inputs); var me = this; self.timer(1ms, function() { me.toggleMenuState() }); return
  • {translate('Audio Input')} +
  • {svg_checkmark}{translate("Mute")}
  • +
    {inputs.map(function(name) { return
  • {svg_checkmark}{translate(name)}
  • ; })} @@ -119,8 +120,12 @@ class AudioInputs: Reactor.Component { } function toggleMenuState() { + var el = this.$(li#enable-audio); + var enabled = handler.get_option(el.id) != "N"; + el.attributes.toggleClass("selected", !enabled); var v = this.get_value(); - for (var el in $$(menu#audio-input>li)) { + for (var el in this.$$(menu#audio-input>li)) { + if (el.id == 'enable-audio') continue; var selected = el.id == v; el.attributes.toggleClass("selected", selected); } @@ -128,9 +133,13 @@ class AudioInputs: Reactor.Component { event click $(menu#audio-input>li) (_, me) { var v = me.id; - if (v == this.get_value()) return; - if (v == this.get_default()) v = ""; - handler.set_option("audio-input", v); + if (v == 'enable-audio') { + handler.set_option(v, handler.get_option(v) != 'N' ? 'N' : ''); + } else { + if (v == this.get_value()) return; + if (v == this.get_default()) v = ""; + handler.set_option("audio-input", v); + } this.toggleMenuState(); } }