Skip to content

Add volume and mute controls#413

Merged
newAM merged 1 commit intonewAM:mainfrom
contemno:main
Jan 3, 2026
Merged

Add volume and mute controls#413
newAM merged 1 commit intonewAM:mainfrom
contemno:main

Conversation

@contemno
Copy link

@contemno contemno commented Nov 27, 2025

Add volume and mute controls

This PR adds support for controlling monitor audio volume and mute state.

Changes

New VCP Codes

  • Added sound_volume (0x62) - continuous value for audio volume control
  • Added display_audio_mute_mode (0x8D) - non-continuous value for mute state

New API

  • Added AudioMuteMode enum with on and off states
  • Added Monitor.get_volume() / Monitor.set_volume() methods
  • Added Monitor.get_audio_mute_mode() / Monitor.set_audio_mute_mode() methods

CLI Changes

New command-line arguments:

  • --get-volume - Get the volume of the first monitor
  • --set-volume <value> - Set the volume of all monitors (0-100)
  • --get-audio-mute-mode - Get the audio mute mode of the first monitor
  • --set-audio-mute-mode <on|off> - Set the audio mute mode of all monitors

Testing

  • Added unit tests for volume get/set operations
  • Added unit tests for audio mute mode get/set with various input types
  • Added CLI tests for all new arguments

Usage Examples

from monitorcontrol import get_monitors

for monitor in get_monitors():
  with monitor:
    try:
      # Volume control
      monitor.set_volume(75)
      print(f"Current volume: {monitor.get_volume()}")
    except:
      print("Volume control unsupported by monitor")
    try:            
      # Mute control
      monitor.set_audio_mute_mode("on")
      print(f"Mute state: {monitor.get_audio_mute_mode()}")
    except:
      print("Mute control unsupported by monitor")
# CLI usage
python -m monitorcontrol --set-volume 50
python -m monitorcontrol --get-volume
python -m monitorcontrol --set-audio-mute-mode on
python -m monitorcontrol --get-audio-mute-mode

@contemno contemno closed this Nov 27, 2025
@contemno contemno reopened this Nov 27, 2025
Copy link
Owner

@newAM newAM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this looks great!

Sorry for the slow review, I forgot about this, and only just got around to cleaning out my GitHub inbox.

@newAM newAM merged commit 9c7a730 into newAM:main Jan 3, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants