Managing WirePlumber with wpctl (with examples)
- Linux
- November 5, 2023
Listing all objects managed by WirePlumber
To list all objects managed by WirePlumber, you can use the following command:
wpctl status
Motivation: This command is useful when you want to get an overview of all the objects that WirePlumber is currently managing. It provides information about the sinks, sources, clients, and nodes that are currently active.
Explanation: The status
argument is used to list all objects managed by WirePlumber.
Example Output:
object-id1 name=sink1 kind=Sink (state=RUNNING, ...)
object-id2 name=source1 kind=Source (state=RUNNING, ...)
object-id3 name=client1 kind=Client (state=IDLE, ...)
The output will display the ID, name, kind, and state of each object.
Printing all properties of an object
To print all properties of a specific object, you can use the following command:
wpctl inspect id
Motivation: This command allows you to view all the properties associated with a particular object in WirePlumber. It can be useful for troubleshooting or understanding the configuration of a specific object.
Explanation: Replace id
with the ID of the object you want to inspect. This can be obtained from the output of the wpctl status
command.
Example Output:
properties:
property1: value1
property2: value2
property3: value3
The output will display all the properties and their corresponding values for the specified object.
Setting an object as the default in its group
To set an object as the default in its group, you can use the following command:
wpctl set-default id
Motivation: This command is helpful when you want to change the default object (e.g., default sink) in a specific group (e.g., sinks). By setting an object as the default, it will be used by default for any clients requesting that type of object.
Explanation: Replace id
with the ID of the object you want to set as the default. This can be obtained from the output of the wpctl status
command.
Example Output: No output will be displayed if the command is successful. The object will be set as the default in its respective group.
Getting the volume of a sink
To get the volume of a sink, you can use the following command:
wpctl get-volume id
Motivation: This command allows you to check the current volume level of a sink. It can be useful for monitoring or adjusting the audio output level.
Explanation: Replace id
with the ID of the sink you want to get the volume of. This can be obtained from the output of the wpctl status
command.
Example Output:
Volume: 50%
The output will display the current volume level of the specified sink.
Setting the volume of a sink to a specific percentage
To set the volume of a sink to a specific percentage, you can use the following command:
wpctl set-volume id n%
Motivation: This command allows you to adjust the volume of a sink to a desired level. It can be used to increase or decrease the volume based on your preferences.
Explanation: Replace id
with the ID of the sink you want to set the volume of. This can be obtained from the output of the wpctl status
command. Replace n
with the desired percentage (0-100) to set the volume to.
Example Output: No output will be displayed if the command is successful. The volume of the specified sink will be set to the desired percentage.
Increasing/Decreasing the volume of a sink by a specific percentage
To increase or decrease the volume of a sink by a specific percentage, you can use the following command:
wpctl set-volume id n%+|-
Motivation: This command provides a convenient way to adjust the volume of a sink up or down by a specific percentage. It is useful when you want to incrementally increase or decrease the audio output level.
Explanation: Replace id
with the ID of the sink you want to adjust the volume of. This can be obtained from the output of the wpctl status
command. Replace n
with the desired percentage (0-100) to increase or decrease the volume by. Append +
or -
after the percentage to specify whether to increase or decrease the volume.
Example Output: No output will be displayed if the command is successful. The volume of the specified sink will be increased or decreased by the specified percentage.
Muting/Unmuting a sink
To mute or unmute a sink, you can use the following command:
wpctl set-mute id 1|0|toggle
Motivation: This command allows you to control the mute status of a sink. It can be used to quickly mute or unmute the audio output without adjusting the volume level.
Explanation: Replace id
with the ID of the sink you want to mute or unmute. This can be obtained from the output of the wpctl status
command. Use 1
to mute the sink, 0
to unmute the sink, or toggle
to toggle between mute and unmute.
Example Output: No output will be displayed if the command is successful. The specified sink will be muted, unmuted, or its mute status will be toggled accordingly.