Skip to content

Commit 7d07efa

Browse files
authored
Add option to mute Remote Access when not controlling the remote computer (#18630)
Closes #18104 Summary of the issue: It is often disruptive to hear what is happening on the remote computer when controling the local computer. As such, users want the ability to automatically mute output from the remote computer when controling the local computer. Description of user facing changes: Added an option to mute the remote computer when controlling the local computer. If enabled: * Mutes the remote computer when first connecting as leader; * Automatically mutes the remote computer when switching from remote to local control. This option is disabled by default. Description of developer facing changes: None Description of development approach: * Refactored `_remoteClient.client.RemoteClient.toggleMute` to rely on an internal use only method that only toggles the mute state, without performing error checks or producing user output. * When connecting as leader, toggle to muted using the internal method if we should mute when controling the local machine. * Use the public method to toggle mute when switching from remote to local control (done so there is clear output, just as is done when switching the other way). * Added a config item to the config spec that mediates this behaviour.. Also added to the Remote Access settings panel. Testing strategy: Connected and disconnected as leader with this setting enabled and disabled and ensured it behaved as expected. Known issues with pull request: None
1 parent 6ea5145 commit 7d07efa

5 files changed

Lines changed: 33 additions & 2 deletions

File tree

source/_remoteClient/client.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,18 @@ def toggleMute(self):
128128
# Translators: Presented when attempting to mute or unmute Remote Access when connected as the controlled computer.
129129
ui.message(pgettext("remote", "Not the controlling computer"))
130130
return
131-
self.localMachine.isMuted = not self.localMachine.isMuted
132-
self.menu.muteItem.Check(self.localMachine.isMuted)
131+
self._doToggleMute()
133132
# Translators: Displayed when muting speech and sounds from the remote computer
134133
MUTE_MESSAGE = _("Muted remote")
135134
# Translators: Displayed when unmuting speech and sounds from the remote computer
136135
UNMUTE_MESSAGE = _("Unmuted remote")
137136
status = MUTE_MESSAGE if self.localMachine.isMuted else UNMUTE_MESSAGE
138137
ui.delayedMessage(status)
139138

139+
def _doToggleMute(self):
140+
self.localMachine.isMuted = not self.localMachine.isMuted
141+
self.menu.muteItem.Check(self.localMachine.isMuted)
142+
140143
def pushClipboard(self):
141144
"""Send local clipboard content to the remote computer.
142145
@@ -360,6 +363,8 @@ def connectAsLeader(self, connectionInfo: ConnectionInfo):
360363
self.leaderTransport = transport
361364
if self.menu:
362365
self.menu.handleConnecting(connectionInfo.mode)
366+
if configuration.getRemoteConfig()["ui"]["muteOnLocalControl"] and not self.localMachine.isMuted:
367+
self._doToggleMute()
363368

364369
@alwaysCallAfter
365370
def onConnectedAsLeader(self):
@@ -565,6 +570,8 @@ def _switchToLocalControl(self) -> None:
565570
self.releaseKeys()
566571
# Translators: Presented when keyboard control is back to the controlling computer.
567572
ui.message(pgettext("remote", "Controlling local computer"))
573+
if configuration.getRemoteConfig()["ui"]["muteOnLocalControl"] and not self.localMachine.isMuted:
574+
self.toggleMute()
568575

569576
def _switchToRemoteControl(self, gesture: KeyboardInputGesture) -> None:
570577
"""Switch to controlling the remote computer."""

source/config/configSpec.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@
362362
__many__ = string(default="")
363363
[[ui]]
364364
confirmDisconnectAsFollower = boolean(default=True)
365+
muteOnLocalControl = boolean(default=False)
365366
"""
366367

367368
#: The configuration specification

source/gui/settingsDialogs.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3402,6 +3402,17 @@ def makeSettings(self, sizer: wx.BoxSizer):
34023402
self.bindHelpEvent("RemoteConfirmDisconnect", self.confirmDisconnectAsFollower)
34033403
enabledInSecureMode.add(self.confirmDisconnectAsFollower)
34043404

3405+
self.muteOnLocalControl = remoteSettingsGroupHelper.addItem(
3406+
wx.CheckBox(
3407+
self.remoteSettingsGroupBox,
3408+
# Translators: A checkbox in Remote Access settings to mute speech and sounds from the remote computer
3409+
# when controlling the local computer.
3410+
label=pgettext("remote", "&Mute when controlling the local computer"),
3411+
),
3412+
)
3413+
self.bindHelpEvent("RemoteMuteOnLocalControl", self.muteOnLocalControl)
3414+
enabledInSecureMode.add(self.muteOnLocalControl)
3415+
34053416
self.autoconnect = remoteSettingsGroupHelper.addItem(
34063417
wx.CheckBox(
34073418
self.remoteSettingsGroupBox,
@@ -3540,6 +3551,7 @@ def _setFromConfig(self) -> None:
35403551
self.port.SetValue(str(controlServer["port"]))
35413552
self.key.SetValue(controlServer["key"])
35423553
self.confirmDisconnectAsFollower.SetValue(self.config["ui"]["confirmDisconnectAsFollower"])
3554+
self.muteOnLocalControl.SetValue(self.config["ui"]["muteOnLocalControl"])
35433555
self._setControls()
35443556

35453557
def _onEnableRemote(self, evt: wx.CommandEvent):
@@ -3604,6 +3616,7 @@ def onSave(self):
36043616
oldEnabled = self.config["enabled"]
36053617
self.config["enabled"] = enabled
36063618
self.config["ui"]["confirmDisconnectAsFollower"] = self.confirmDisconnectAsFollower.GetValue()
3619+
self.config["ui"]["muteOnLocalControl"] = self.muteOnLocalControl.GetValue()
36073620
controlServer = self.config["controlServer"]
36083621
selfHosted = self.clientOrServer.GetSelection()
36093622
controlServer["autoconnect"] = self.autoconnect.GetValue()

user_docs/en/changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Localisation data for emojis has been added for Belarusian and Bosnian.
2323
* Minimum and last tested version will now be also shown in the details area for an add-on in the Available Add-ons tab. (#18440, @nvdaes)
2424
* Installation date will now be also shown in the details area for external add-ons. (#18560, @CyrilleB79)
2525
* A new unassigned command has been added to send `control+alt+delete` when controlling another computer via NVDA Remote Access. (#18105)
26+
* A new setting has been added to automatically mute Remote Access when controlling the local computer. (#18630)
2627

2728
### Changes
2829

user_docs/en/userGuide.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3174,6 +3174,15 @@ This option controls whether confirmation is required before disconnecting from
31743174
When checked, NVDA will ask for confirmation before disconnecting.
31753175
When unchecked, NVDA will disconnect immediately without confirmation.
31763176

3177+
##### Mute when controlling the local computer {#RemoteMuteOnLocalControl}
3178+
3179+
This option controls whether you can hear speech and sounds from the remote computer when controlling the local computer.
3180+
3181+
When checked, Remote Access will be muted automatically when first connecting as the controlling computer, and when switching to controlling the local computer.
3182+
When unchecked, Remote Access sessions start unmuted, and must be muted explicitly.
3183+
3184+
You can still manually mute or unmute Remote Access when controlling the local computer [via the Remote Access menu](#RemoteAccessUsage), or by assigning a custom gesture using the [Input Gestures dialog](#InputGestures).
3185+
31773186
##### Automatically connect after NVDA starts {#RemoteAutoconnect}
31783187

31793188
This option allows you to automatically establish a Remote Access session when NVDA starts.

0 commit comments

Comments
 (0)