libdesktop.volume

A module for interacting with the system audio volume.

libdesktop.volume.decrease_volume(percentage)[source]

Decrease the volume.

Decrease the volume by a given percentage.

Parameters:percentage (int) – The percentage (as an integer between 0 and 100) to decrease the volume by.
Raises:ValueError – if the percentage is >100 or <0.
libdesktop.volume.get_volume()[source]

Get the volume.

Get the current volume.

Returns:The current volume (percentage, between 0 and 100).
Return type:int
libdesktop.volume.increase_volume(percentage)[source]

Increase the volume.

Increase the volume by a given percentage.

Parameters:percentage (int) – The percentage (as an integer between 0 and 100) to increase the volume by.
Raises:ValueError – if the percentage is >100 or <0.
libdesktop.volume.is_muted()[source]

Check if volume is muted.

Checks if the volume is muted.

Note

This does not check for volume == 0.

Returns:Is the volume muted?
Return type:bool
libdesktop.volume.mute()[source]

Mute the volume.

Mutes the volume.

libdesktop.volume.set_volume(percentage)[source]

Set the volume.

Sets the volume to a given percentage (integer between 0 and 100).

Parameters:percentage (int) – The percentage (as a 0 to 100 integer) to set the volume to.
Raises:ValueError – if the percentage is >100 or <0.
libdesktop.volume.unix_is_pulseaudio_server()[source]

Check if PulseAudio is running as sound server.

Checks if PulseAudio is running as the sound server.

Returns:Is PulseAudio the sound server?
Return type:bool
libdesktop.volume.unmute()[source]

Unmute the volume.

Unmutes the system volume.

Note

On some systems, volume is restored to its previous level after unmute, or set to 100.