| 1 |
# This example configuration file specifies loopback nodes that can be used |
| 2 |
# to apply a role-based linking policy. |
| 3 |
# |
| 4 |
# The loopbacks are simply created by loading the libpipewire-module-loopback |
| 5 |
# pipewire module with the appropriate options. You may also create these |
| 6 |
# loopbacks in the pipewire daemon process by configuring them in pipewire.conf |
| 7 |
# (using pipewire's syntax) instead of here. |
| 8 |
|
| 9 |
wireplumber.profiles = { |
| 10 |
main = { |
| 11 |
policy.linking.role-based.loopbacks = required |
| 12 |
} |
| 13 |
} |
| 14 |
|
| 15 |
wireplumber.settings = { |
| 16 |
# This sets a default media role to be applied to streams that don't have |
| 17 |
# a role already set. This allows you to force all streams to go through |
| 18 |
# the role loopbacks. If not set, then streams without a role will follow |
| 19 |
# the standard desktop policy and will link to the default sink |
| 20 |
node.stream.default-media-role = "Multimedia" |
| 21 |
|
| 22 |
## This allows you to tweak the volume level that is applied when ducking |
| 23 |
#linking.role-based.duck-level = 0.3 |
| 24 |
} |
| 25 |
|
| 26 |
wireplumber.components.rules = [ |
| 27 |
# This encodes common arguments and dependencies of the role loopbacks so that |
| 28 |
# we don't have to repeateadly write them on all instances below |
| 29 |
{ |
| 30 |
matches = [ |
| 31 |
{ |
| 32 |
provides = "~loopback.sink.*" |
| 33 |
} |
| 34 |
] |
| 35 |
actions = { |
| 36 |
merge = { |
| 37 |
arguments = { |
| 38 |
capture.props = { |
| 39 |
# Explicitly mark all these sinks as valid role-based policy |
| 40 |
# targets, meaning that any links between streams and these sinks |
| 41 |
# will be managed by the role-based policy |
| 42 |
policy.role-based.target = true |
| 43 |
|
| 44 |
audio.position = [ FL, FR ] |
| 45 |
media.class = Audio/Sink |
| 46 |
} |
| 47 |
playback.props = { |
| 48 |
# This must be set to ensure that the real audio sink is suspended |
| 49 |
# when there is no active client stream linked |
| 50 |
node.passive = true |
| 51 |
# Set this to an unused role to make sure that loopbacks don't |
| 52 |
# accidentally chain-link on to one another, especially when |
| 53 |
# node.stream.default-media-role is configured in the settings |
| 54 |
media.role = "Loopback" |
| 55 |
} |
| 56 |
} |
| 57 |
requires = [ support.export-core, pw.node-factory.adapter ] |
| 58 |
} |
| 59 |
} |
| 60 |
} |
| 61 |
] |
| 62 |
|
| 63 |
wireplumber.components = [ |
| 64 |
{ |
| 65 |
type = virtual, provides = policy.linking.role-based.loopbacks |
| 66 |
requires = [ loopback.sink.role.multimedia |
| 67 |
loopback.sink.role.notification |
| 68 |
loopback.sink.role.navigation |
| 69 |
loopback.sink.role.assistant |
| 70 |
loopback.sink.role.communication |
| 71 |
loopback.sink.role.alert ] |
| 72 |
} |
| 73 |
{ |
| 74 |
name = libpipewire-module-loopback, type = pw-module |
| 75 |
arguments = { |
| 76 |
node.name = "loopback.sink.role.multimedia" |
| 77 |
node.description = "Multimedia" |
| 78 |
capture.props = { |
| 79 |
device.intended-roles = [ "Music", "Movie", "Game", "Multimedia" ] |
| 80 |
policy.role-based.priority = 10 |
| 81 |
policy.role-based.action.same-priority = "mix" |
| 82 |
policy.role-based.action.lower-priority = "mix" |
| 83 |
} |
| 84 |
} |
| 85 |
provides = loopback.sink.role.multimedia |
| 86 |
} |
| 87 |
{ |
| 88 |
name = libpipewire-module-loopback, type = pw-module |
| 89 |
arguments = { |
| 90 |
node.name = "loopback.sink.role.notification" |
| 91 |
node.description = "System Notifications" |
| 92 |
capture.props = { |
| 93 |
device.intended-roles = [ "Notification" ] |
| 94 |
policy.role-based.priority = 20 |
| 95 |
policy.role-based.action.same-priority = "mix" |
| 96 |
policy.role-based.action.lower-priority = "mix" |
| 97 |
} |
| 98 |
} |
| 99 |
provides = loopback.sink.role.notification |
| 100 |
} |
| 101 |
{ |
| 102 |
name = libpipewire-module-loopback, type = pw-module |
| 103 |
arguments = { |
| 104 |
node.name = "loopback.sink.role.navigation" |
| 105 |
node.description = "Navigation" |
| 106 |
capture.props = { |
| 107 |
device.intended-roles = [ "Navigation", "GPS" ] |
| 108 |
policy.role-based.priority = 30 |
| 109 |
policy.role-based.action.same-priority = "mix" |
| 110 |
policy.role-based.action.lower-priority = "duck" |
| 111 |
} |
| 112 |
} |
| 113 |
provides = loopback.sink.role.navigation |
| 114 |
} |
| 115 |
{ |
| 116 |
name = libpipewire-module-loopback, type = pw-module |
| 117 |
arguments = { |
| 118 |
node.name = "loopback.sink.role.assistant" |
| 119 |
node.description = "Voice Assistant" |
| 120 |
capture.props = { |
| 121 |
device.intended-roles = [ "Assistant" ] |
| 122 |
policy.role-based.priority = 40 |
| 123 |
policy.role-based.action.same-priority = "mix" |
| 124 |
policy.role-based.action.lower-priority = "cork" |
| 125 |
} |
| 126 |
} |
| 127 |
provides = loopback.sink.role.assistant |
| 128 |
} |
| 129 |
{ |
| 130 |
name = libpipewire-module-loopback, type = pw-module |
| 131 |
arguments = { |
| 132 |
node.name = "loopback.sink.role.communication" |
| 133 |
node.description = "Communication" |
| 134 |
capture.props = { |
| 135 |
device.intended-roles = [ "Communication", "Phone" ] |
| 136 |
policy.role-based.priority = 50 |
| 137 |
policy.role-based.action.same-priority = "mix" |
| 138 |
policy.role-based.action.lower-priority = "cork" |
| 139 |
} |
| 140 |
} |
| 141 |
provides = loopback.sink.role.communication |
| 142 |
} |
| 143 |
{ |
| 144 |
name = libpipewire-module-loopback, type = pw-module |
| 145 |
arguments = { |
| 146 |
node.name = "loopback.sink.role.alert" |
| 147 |
node.description = "Alert" |
| 148 |
capture.props = { |
| 149 |
device.intended-roles = [ "Alert", "Emergency" ] |
| 150 |
policy.role-based.priority = 100 |
| 151 |
policy.role-based.action.same-priority = "mix" |
| 152 |
policy.role-based.action.lower-priority = "cork" |
| 153 |
policy.role-based.preferred-target = "Speaker" |
| 154 |
} |
| 155 |
} |
| 156 |
provides = loopback.sink.role.alert |
| 157 |
} |
| 158 |
] |