| 1 | \page page_man_pipewire_conf_5 pipewire.conf |
| 2 | |
| 3 | The PipeWire server configuration file |
| 4 | |
| 5 | \tableofcontents |
| 6 | |
| 7 | # SYNOPSIS |
| 8 | |
| 9 | *$XDG_CONFIG_HOME/pipewire/pipewire.conf* |
| 10 | |
| 11 | *$(PIPEWIRE_CONFIG_DIR)/pipewire.conf* |
| 12 | |
| 13 | *$(PIPEWIRE_CONFDATADIR)/pipewire.conf* |
| 14 | |
| 15 | *$(PIPEWIRE_CONFDATADIR)/pipewire.conf.d/* |
| 16 | |
| 17 | *$(PIPEWIRE_CONFIG_DIR)/pipewire.conf.d/* |
| 18 | |
| 19 | *$XDG_CONFIG_HOME/pipewire/pipewire.conf.d/* |
| 20 | |
| 21 | # DESCRIPTION |
| 22 | |
| 23 | PipeWire is a service that facilitates sharing of multimedia content |
| 24 | between devices and applications. |
| 25 | |
| 26 | On startup, the daemon reads a main configuration file to configure |
| 27 | itself. It executes a series of commands listed in the config file. |
| 28 | |
| 29 | The config file is looked up in the order listed in the |
| 30 | [SYNOPSIS](#synopsis). The environment variables `PIPEWIRE_CONFIG_DIR`, |
| 31 | `PIPEWIRE_CONFIG_PREFIX` and `PIPEWIRE_CONFIG_NAME` can be used to |
| 32 | specify an alternative config directory, subdirectory and file |
| 33 | respectively. |
| 34 | |
| 35 | Other PipeWire configuration files generally follow the same lookup |
| 36 | logic, replacing `pipewire.conf` with the name of the particular |
| 37 | config file. |
| 38 | |
| 39 | # DROP-IN CONFIGURATION FILES @IDX@ pipewire.conf |
| 40 | |
| 41 | All `*.conf` files in the `pipewire.conf.d/` directories are loaded |
| 42 | and merged into the configuration. Dictionary sections are merged, |
| 43 | overriding properties if they already existed, and array sections are |
| 44 | appended to. The drop-in files have same format as the main |
| 45 | configuration file, but only contain the settings to be modified. |
| 46 | |
| 47 | As the `pipewire.conf` configuration file contains various parts |
| 48 | that must be present for correct functioning, using drop-in files |
| 49 | for configuration is recommended. |
| 50 | |
| 51 | ## Example |
| 52 | |
| 53 | A configuration file `~/.config/pipewire/pipewire.conf.d/custom.conf` |
| 54 | to change the value of the `default.clock.min-quantum` setting in `pipewire.conf`: |
| 55 | |
| 56 | ``` |
| 57 | # ~/.config/pipewire/pipewire.conf.d/custom.conf |
| 58 | |
| 59 | context.properties = { |
| 60 | default.clock.min-quantum = 128 |
| 61 | } |
| 62 | ``` |
| 63 | |
| 64 | # CONFIGURATION FILE FORMAT @IDX@ pipewire.conf |
| 65 | |
| 66 | The configuration file is in "SPA" JSON format. |
| 67 | |
| 68 | The configuration file contains top-level keys, which are the sections. |
| 69 | The value of a section is either a dictionary, `{ }`, or an |
| 70 | array, `[ ]`. Section and dictionary item declarations |
| 71 | have `KEY = VALUE` form, and are separated by whitespace. |
| 72 | For example: |
| 73 | |
| 74 | ``` |
| 75 | context.properties = { # top-level dictionary section |
| 76 | |
| 77 | key1 = value # a simple value |
| 78 | |
| 79 | key2 = { key1 = value1 key2 = value2 } # a dictionary with two entries |
| 80 | |
| 81 | key3 = [ value1 value2 ] # an array with two entries |
| 82 | |
| 83 | key4 = [ { k = v1 } { k = v2 } ] # an array of dictionaries |
| 84 | |
| 85 | } |
| 86 | |
| 87 | context.modules = [ # top-level array section |
| 88 | |
| 89 | value1 |
| 90 | |
| 91 | value2 |
| 92 | |
| 93 | ] |
| 94 | ``` |
| 95 | |
| 96 | The configuration files can also be written in standard JSON syntax, |
| 97 | but for easier manual editing, the relaxed "SPA" variant is allowed. |
| 98 | In "SPA" JSON: |
| 99 | |
| 100 | - `:` to delimit keys and values can be substituted by `=` or a space. |
| 101 | - <tt>\"</tt> around keys and string can be omitted as long as no special |
| 102 | characters are used in the strings. |
| 103 | - `,` to separate objects can be replaced with a whitespace character. |
| 104 | - `#` can be used to start a comment until the line end |
| 105 | |
| 106 | # CONFIGURATION FILE SECTIONS @IDX@ pipewire.conf |
| 107 | |
| 108 | \par context.properties |
| 109 | Dictionary. These properties configure the PipeWire instance. |
| 110 | |
| 111 | \par context.spa-libs |
| 112 | Dictionary. Maps plugin features with globs to a spa library. |
| 113 | |
| 114 | \par context.modules |
| 115 | Array of dictionaries. Each entry in the array is a dictionary with the |
| 116 | *name* of the module to load, including optional *args* and *flags*. |
| 117 | Most modules support being loaded multiple times. |
| 118 | |
| 119 | \par context.objects |
| 120 | Array of dictionaries. Each entry in the array is a dictionary |
| 121 | containing the *factory* to create an object from and optional extra |
| 122 | arguments specific to that factory. |
| 123 | |
| 124 | \par context.exec |
| 125 | \parblock |
| 126 | Array of dictionaries. Each entry in the array is dictionary containing |
| 127 | the *path* of a program to execute on startup and optional *args*. |
| 128 | |
| 129 | This array used to contain an entry to start the session manager but |
| 130 | this mode of operation has since been demoted to development aid. Avoid |
| 131 | starting a session manager in this way in production environment. |
| 132 | \endparblock |
| 133 | |
| 134 | \par node.rules |
| 135 | Array of dictionaries. Match rules for modifying node properties |
| 136 | on the server. |
| 137 | |
| 138 | \par device.rules |
| 139 | Array of dictionaries. Match rules for modifying device properties |
| 140 | on the server. |
| 141 | |
| 142 | |
| 143 | # CONTEXT PROPERTIES @IDX@ pipewire.conf context.properties |
| 144 | |
| 145 | Available PipeWire properties in `context.properties` and possible |
| 146 | default values. |
| 147 | |
| 148 | @PAR@ pipewire.conf clock.power-of-two-quantum = true |
| 149 | The quantum requests from the clients and the final graph quantum are |
| 150 | rounded down to a power of two. A power of two quantum can be more |
| 151 | efficient for many processing tasks. |
| 152 | |
| 153 | @PAR@ pipewire.conf context.data-loop.library.name.system |
| 154 | The name of the shared library to use for the system functions for the data processing |
| 155 | thread. This can typically be changed if the data thread is running on a realtime |
| 156 | kernel such as EVL. |
| 157 | |
| 158 | @PAR@ pipewire.conf loop.rt-prio = -1 |
| 159 | The priority of the data loops. The data loops are used to schedule the nodes in the graph. |
| 160 | A value of -1 uses the default realtime priority from the module-rt. A value of 0 disables |
| 161 | realtime scheduling for the data loops. |
| 162 | |
| 163 | @PAR@ pipewire.conf loop.class = [ data.rt .. ] |
| 164 | An array of classes of the data loops. Normally nodes are assigned to a loop by name or by class. |
| 165 | Nodes are by default assigned to the data.rt class so it is good to have a data loop |
| 166 | of this class as well. |
| 167 | |
| 168 | @PAR@ pipewire.conf context.num-data-loops = 1 |
| 169 | The number of data loops to create. By default 1 data-loop is created and all nodes are |
| 170 | scheduled in this thread. A value of 0 disables the real-time data loops and schedules |
| 171 | all nodes in the main thread. A value of -1 spawns as many data threads as there are |
| 172 | cpu cores. |
| 173 | |
| 174 | @PAR@ pipewire.conf context.data-loops = [ ... ] |
| 175 | This controls the data loops that will be created for the context. Is is an array of |
| 176 | data loop specifications, one entry for each data loop to start: |
| 177 | ``` |
| 178 | # ~/.config/pipewire/pipewire.conf.d/custom.conf |
| 179 | |
| 180 | context.data-loops = [ |
| 181 | { |
| 182 | #library.name.system = support/libspa-support |
| 183 | loop.rt-prio = -1 |
| 184 | loop.class = [ data.rt .. ] |
| 185 | thread.name = data-loop.0 |
| 186 | thread.affinity = [ 0 1 ] |
| 187 | } |
| 188 | ... |
| 189 | ] |
| 190 | ``` |
| 191 | A specific priority, classes and name can be given with loop.rt-prio, loop.class and |
| 192 | thread.name respectively. It is also possible to pin the data loop to specific CPU |
| 193 | cores with the thread.affinity property. |
| 194 | |
| 195 | @PAR@ pipewire.conf core.daemon = false |
| 196 | Makes the PipeWire process, started with this config, a daemon |
| 197 | process. This means that it will manage and schedule a graph for |
| 198 | clients. You would also want to configure a core.name to give it a |
| 199 | well known name. |
| 200 | |
| 201 | @PAR@ pipewire.conf core.name = pipewire-0 |
| 202 | The name of the PipeWire context. This will also be the name of the |
| 203 | PipeWire socket clients can connect to. |
| 204 | |
| 205 | @PAR@ pipewire.conf cpu.zero.denormals = false |
| 206 | Configures the CPU to zero denormals automatically. This will be |
| 207 | enabled for the data processing thread only, when enabled. |
| 208 | |
| 209 | @PAR@ pipewire.conf cpu.vm.name = null |
| 210 | This will be set automatically when the context is created and will |
| 211 | contain the name of the VM. It is typically used to write match rules |
| 212 | to set extra properties. |
| 213 | |
| 214 | @PAR@ pipewire.conf default.clock.rate = 48000 |
| 215 | The default clock rate determines the real time duration of the |
| 216 | min/max/default quantums. You might want to change the quantums when |
| 217 | you change the default clock rate to maintain the same duration for |
| 218 | the quantums. |
| 219 | |
| 220 | @PAR@ pipewire.conf default.clock.allowed-rates = [ ] |
| 221 | It is possible to specify up to 32 alternative sample rates. The graph |
| 222 | sample rate will be switched when devices are idle. Note that this is |
| 223 | not enabled by default for now because of various kernel and Bluetooth |
| 224 | issues. Note that the min/max/default quantum values are scaled when |
| 225 | the samplerate changes. |
| 226 | |
| 227 | @PAR@ pipewire.conf default.clock.min-quantum = 32 |
| 228 | Default minimum quantum. |
| 229 | |
| 230 | @PAR@ pipewire.conf default.clock.max-quantum = 8192 |
| 231 | Default maximum quantum. |
| 232 | |
| 233 | @PAR@ pipewire.conf default.clock.quantum = 1024 |
| 234 | Default quantum used when no client specifies one. |
| 235 | |
| 236 | @PAR@ pipewire.conf default.clock.quantum-limit = 8192 |
| 237 | Maximum quantum to reserve space for. This is the maximum buffer size used |
| 238 | in the graph, regardless of the samplerate. |
| 239 | |
| 240 | @PAR@ pipewire.conf default.clock.quantum-floor = 4 |
| 241 | Minimum quantum to reserve space for. This is the minimum buffer size used |
| 242 | in the graph, regardless of the samplerate. |
| 243 | |
| 244 | @PAR@ pipewire.conf default.video.width |
| 245 | Default video width |
| 246 | |
| 247 | @PAR@ pipewire.conf default.video.height |
| 248 | Default video height |
| 249 | |
| 250 | @PAR@ pipewire.conf default.video.rate.num |
| 251 | Default video rate numerator |
| 252 | |
| 253 | @PAR@ pipewire.conf default.video.rate.denom |
| 254 | Default video rate denominator |
| 255 | |
| 256 | @PAR@ pipewire.conf library.name.system = support/libspa-support |
| 257 | The name of the shared library to use for the system functions for the main thread. |
| 258 | |
| 259 | @PAR@ pipewire.conf link.max-buffers = 64 |
| 260 | The maximum number of buffers to negotiate between nodes. Note that version < 3 clients |
| 261 | can only support 16 buffers. More buffers is almost always worse than less, latency |
| 262 | and memory wise. |
| 263 | |
| 264 | @PAR@ pipewire.conf log.level = 2 |
| 265 | The default log level used by the process. |
| 266 | |
| 267 | @PAR@ pipewire.conf mem.allow-mlock = true |
| 268 | Try to mlock the memory for the realtime processes. Locked memory will |
| 269 | not be swapped out by the kernel and avoid hickups in the processing |
| 270 | threads. |
| 271 | |
| 272 | @PAR@ pipewire.conf mem.warn-mlock = false |
| 273 | Warn about failures to lock memory. |
| 274 | |
| 275 | @PAR@ pipewire.conf mem.mlock-all = false |
| 276 | Try to mlock all current and future memory by the process. |
| 277 | |
| 278 | @PAR@ pipewire.conf rlimit.nofile = 4096 |
| 279 | Try to set the max file descriptor number resource limit of the process. |
| 280 | A value of -1 raises the limit to the system defined hard maximum value. |
| 281 | The file resource limit is usually 1024 and should only be raised if the |
| 282 | program does not use the select() system call. PipeWire does normally not |
| 283 | use select(). |
| 284 | |
| 285 | @PAR@ pipewire.conf rlimit.*resource* = *value* |
| 286 | Set resource limits. *resource* can be one of: as, core, cpu, |
| 287 | data, fsize, locks, memlock, msgqueue, nice, nofile, nproc, rss, rtprio, |
| 288 | rttime, sigpending or stack. See the documentation of setrlimit to get the |
| 289 | meaning of these resources. A value of -1 will set the maximum allowed |
| 290 | limit. |
| 291 | |
| 292 | @PAR@ pipewire.conf settings.check-quantum = false |
| 293 | Check if the quantum in the settings metadata update is compatible |
| 294 | with the configured limits. |
| 295 | |
| 296 | @PAR@ pipewire.conf settings.check-rate = false |
| 297 | Check if the rate in the settings metadata update is compatible |
| 298 | with the configured limits. |
| 299 | |
| 300 | @PAR@ pipewire.conf support.dbus = true |
| 301 | Enable DBus support. This will enable DBus support in the various modules that require |
| 302 | it. Disable this if you want to globally disable DBus support in the process. |
| 303 | |
| 304 | @PAR@ pipewire.conf vm.overrides = { default.clock.min-quantum = 1024 } |
| 305 | Any property in the vm.overrides property object will override the property |
| 306 | in the context.properties when PipeWire detects it is running in a VM. This |
| 307 | is deprecated, use the context.properties.rules instead. |
| 308 | |
| 309 | @PAR@ pipewire.conf context.modules.allow-empty = false |
| 310 | By default, a warning is logged when there are no context.modules loaded because this |
| 311 | likely indicates there is a problem. Some applications might load the modules themselves |
| 312 | and when they set this property to true, no warning will be logged. |
| 313 | |
| 314 | The context properties may also contain custom values. For example, |
| 315 | the `context.modules` and `context.objects` sections can declare |
| 316 | additional conditions that control whether a module or object is loaded |
| 317 | depending on what properties are present. |
| 318 | |
| 319 | # SPA LIBRARIES @IDX@ pipewire.conf context.spa-libs |
| 320 | |
| 321 | SPA plugins are loaded based on their factory-name. This is a well |
| 322 | known name that uniquely describes the features that the plugin should |
| 323 | have. The `context.spa-libs` section provides a mapping between the |
| 324 | factory-name and the plugin where the factory can be found. |
| 325 | |
| 326 | Factory names can contain a wildcard to group several related factories into one |
| 327 | plugin. The plugin is loaded from the first matching factory-name. |
| 328 | |
| 329 | ## Example |
| 330 | |
| 331 | ``` |
| 332 | # ~/.config/pipewire/pipewire.conf.d/custom.conf |
| 333 | |
| 334 | context.spa-libs = { |
| 335 | audio.convert.* = audioconvert/libspa-audioconvert |
| 336 | avb.* = avb/libspa-avb |
| 337 | api.alsa.* = alsa/libspa-alsa |
| 338 | api.v4l2.* = v4l2/libspa-v4l2 |
| 339 | api.libcamera.* = libcamera/libspa-libcamera |
| 340 | api.bluez5.* = bluez5/libspa-bluez5 |
| 341 | api.vulkan.* = vulkan/libspa-vulkan |
| 342 | api.jack.* = jack/libspa-jack |
| 343 | support.* = support/libspa-support |
| 344 | video.convert.* = videoconvert/libspa-videoconvert |
| 345 | } |
| 346 | ``` |
| 347 | |
| 348 | # MODULES @IDX@ pipewire.conf context.modules |
| 349 | |
| 350 | PipeWire modules to be loaded. See |
| 351 | \ref page_man_libpipewire-modules_7 "libpipewire-modules(7)". |
| 352 | |
| 353 | ``` |
| 354 | # ~/.config/pipewire/pipewire.conf.d/custom.conf |
| 355 | |
| 356 | context.modules = [ |
| 357 | #{ name = MODULENAME |
| 358 | # ( args = { KEY = VALUE ... } ) |
| 359 | # ( flags = [ ( ifexists ) ( nofail ) ] ) |
| 360 | # ( condition = [ { KEY = VALUE ... } ... ] ) |
| 361 | #} |
| 362 | # |
| 363 | ] |
| 364 | ``` |
| 365 | |
| 366 | \par name |
| 367 | Name of module to be loaded |
| 368 | |
| 369 | \par args = { } |
| 370 | Arguments passed to the module |
| 371 | |
| 372 | \par flags = [ ] |
| 373 | Loading flags. `ifexists` to only load module if it exists, |
| 374 | and `nofail` to not fail PipeWire startup if the module fails to load. |
| 375 | |
| 376 | \par condition = [ ] |
| 377 | A \ref pipewire_conf__match_rules "match rule" `matches` condition. |
| 378 | The module is loaded only if one of the expressions in the array matches |
| 379 | to a context property. |
| 380 | |
| 381 | # CONTEXT OBJECTS @IDX@ pipewire.conf context.objects |
| 382 | |
| 383 | The `context.objects` section allows you to make some objects from factories (usually created |
| 384 | by loading modules in `context.modules`). |
| 385 | |
| 386 | ``` |
| 387 | # ~/.config/pipewire/pipewire.conf.d/custom.conf |
| 388 | |
| 389 | context.objects = [ |
| 390 | #{ factory = <factory-name> |
| 391 | # ( args = { <key> = <value> ... } ) |
| 392 | # ( flags = [ ( nofail ) ] ) |
| 393 | # ( condition = [ { <key> = <value> ... } ... ] ) |
| 394 | #} |
| 395 | ] |
| 396 | ``` |
| 397 | This section can be used to make nodes or links between nodes. |
| 398 | |
| 399 | \par factory |
| 400 | Name of the factory to create the object. |
| 401 | |
| 402 | \par args = { } |
| 403 | Arguments passed to the factory. |
| 404 | |
| 405 | \par flags = [ ] |
| 406 | Flag `nofail` to not fail PipeWire startup if the object fails to load. |
| 407 | |
| 408 | \par condition = [ ] |
| 409 | A \ref pipewire_conf__match_rules "match rule" `matches` condition. |
| 410 | The object is created only if one of the expressions in the array matches |
| 411 | to a context property. |
| 412 | |
| 413 | ## Example |
| 414 | |
| 415 | This fragment creates a new dummy driver node, but only if |
| 416 | `core.daemon` property is true: |
| 417 | |
| 418 | ``` |
| 419 | # ~/.config/pipewire/pipewire.conf.d/custom.conf |
| 420 | |
| 421 | context.objects = [ |
| 422 | { factory = spa-node-factory |
| 423 | args = { |
| 424 | factory.name = support.node.driver |
| 425 | node.name = Dummy-Driver |
| 426 | node.group = pipewire.dummy |
| 427 | priority.driver = 20000 |
| 428 | }, |
| 429 | condition = [ { core.daemon = true } ] |
| 430 | } |
| 431 | ] |
| 432 | ``` |
| 433 | |
| 434 | # COMMAND EXECUTION @IDX@ pipewire.conf context.exec |
| 435 | |
| 436 | The `context.exec` section can be used to start arbitrary commands as |
| 437 | part of the initialization of the PipeWire program. |
| 438 | |
| 439 | ``` |
| 440 | # ~/.config/pipewire/pipewire.conf.d/custom.conf |
| 441 | |
| 442 | context.exec = [ |
| 443 | #{ path = <program-name> |
| 444 | # ( args = "<arguments>" | [ <arg1> <arg2> ... ] ) |
| 445 | # ( condition = [ { <key> = <value> ... } ... ] ) |
| 446 | #} |
| 447 | ] |
| 448 | ``` |
| 449 | |
| 450 | \par path |
| 451 | Program to execute. |
| 452 | |
| 453 | \par args |
| 454 | Arguments to the program. |
| 455 | |
| 456 | \par condition |
| 457 | A \ref pipewire_conf__match_rules "match rule" `matches` condition. |
| 458 | The object is created only if one of the expressions in the array matches |
| 459 | to a context property. |
| 460 | |
| 461 | ## Example |
| 462 | |
| 463 | The following fragment executes a pactl command with the given arguments: |
| 464 | |
| 465 | ``` |
| 466 | # ~/.config/pipewire/pipewire.conf.d/custom.conf |
| 467 | |
| 468 | context.exec = [ |
| 469 | { path = "pactl" args = "load-module module-always-sink" } |
| 470 | ] |
| 471 | ``` |
| 472 | |
| 473 | # MATCH RULES @IDX@ pipewire.conf |
| 474 | |
| 475 | Some configuration file sections contain match rules. This makes it |
| 476 | possible to perform some action when an object (usually a node or |
| 477 | stream) is created/updated that matches certain properties. |
| 478 | |
| 479 | The general rules object follows the following pattern: |
| 480 | ```css |
| 481 | <rules> = [ |
| 482 | { |
| 483 | matches = [ |
| 484 | # any of the following sets of properties are matched, if |
| 485 | # any matches, the actions are executed |
| 486 | { |
| 487 | # <key> = <value> |
| 488 | # all keys must match the value. ! negates. ~ starts regex. |
| 489 | #application.process.binary = "teams" |
| 490 | #application.name = "~speech-dispatcher.*" |
| 491 | |
| 492 | # Absence of property can be tested by comparing to null |
| 493 | #pipewire.sec.flatpak = null |
| 494 | } |
| 495 | { |
| 496 | # more matches here... |
| 497 | } |
| 498 | ... |
| 499 | ] |
| 500 | actions = { |
| 501 | <action-name> = <action value> |
| 502 | ... |
| 503 | } |
| 504 | } |
| 505 | ] |
| 506 | ``` |
| 507 | Match rules are an array of rules. |
| 508 | |
| 509 | A rule is always a JSON object with two keys: matches and actions. The matches key is used to |
| 510 | define the conditions that need to be met for the rule to be evaluated as true, and the actions |
| 511 | key is used to define the actions that are performed when the rule is evaluated as true. |
| 512 | |
| 513 | The matches key is always a JSON array of objects, where each object defines a condition that needs |
| 514 | to be met. Each condition is a list of key-value pairs, where the key is the name of the property |
| 515 | that is being matched, and the value is the value that the property needs to have. Within a condition, |
| 516 | all the key-value pairs are combined with a logical AND, and all the conditions in the matches |
| 517 | array are combined with a logical OR. |
| 518 | |
| 519 | The actions key is always a JSON object, where each key-value pair defines an action that is |
| 520 | performed when the rule is evaluated as true. The action name is specific to the rule and is |
| 521 | defined by the rule’s documentation, but most frequently you will see the update-props action, |
| 522 | which is used to update the properties of the matched object. |
| 523 | |
| 524 | In the matches array, it is also possible to use regular expressions to match property values. |
| 525 | For example, to match all nodes with a name that starts with my_, you can use the following condition: |
| 526 | |
| 527 | ```css |
| 528 | matches = [ |
| 529 | { |
| 530 | node.name = "~my_.*" |
| 531 | } |
| 532 | ] |
| 533 | ``` |
| 534 | |
| 535 | The ~ character signifies that the value is a regular expression. The exact syntax of the regular |
| 536 | expressions is the POSIX extended regex syntax, as described in the regex (7) man page. |
| 537 | |
| 538 | In addition to regular expressions, you may also use the ! character to negate a condition. For |
| 539 | example, to match all nodes with a name that does not start with my_, you can use the following condition: |
| 540 | |
| 541 | ```css |
| 542 | matches = [ |
| 543 | { |
| 544 | node.name = "!~my_.*" |
| 545 | } |
| 546 | ] |
| 547 | ``` |
| 548 | |
| 549 | The ! character can be used with or without a regular expression. For example, to match all |
| 550 | nodes with a name that is not equal to my_node, you can use the following condition: |
| 551 | |
| 552 | ```css |
| 553 | matches = [ |
| 554 | { |
| 555 | node.name = "!my_node" |
| 556 | } |
| 557 | ] |
| 558 | ``` |
| 559 | |
| 560 | The null value has a special meaning; it checks if the property is not available |
| 561 | (or unset). To check if a property is not set: |
| 562 | |
| 563 | ```css |
| 564 | matches = [ |
| 565 | { |
| 566 | node.name = null |
| 567 | } |
| 568 | ] |
| 569 | ``` |
| 570 | |
| 571 | To check the existence of a property, one can use the !null condition, for example: |
| 572 | |
| 573 | ```css |
| 574 | matches = [ |
| 575 | { |
| 576 | node.name = "!null" |
| 577 | } |
| 578 | { |
| 579 | node.name = !null # simplified syntax |
| 580 | } |
| 581 | ] |
| 582 | ``` |
| 583 | To handle the "null" string, one needs to escape the string. For example, to check |
| 584 | if a property has the string value "null", use: |
| 585 | |
| 586 | ```css |
| 587 | matches = [ |
| 588 | { |
| 589 | node.name = "null" |
| 590 | } |
| 591 | ] |
| 592 | ``` |
| 593 | To handle anything but the "null" string, use: |
| 594 | |
| 595 | ```css |
| 596 | matches = [ |
| 597 | { |
| 598 | node.name = "!\"null\"" |
| 599 | } |
| 600 | { |
| 601 | node.name = !"null" # simplified syntax |
| 602 | } |
| 603 | ] |
| 604 | ``` |
| 605 | |
| 606 | |
| 607 | # CONTEXT PROPERTIES RULES @IDX@ pipewire.conf context.properties.rules |
| 608 | |
| 609 | `context.properties.rules` can be used to dynamically update the properties |
| 610 | based on other properties. |
| 611 | |
| 612 | A typical case is to update custom settings when running inside a VM. |
| 613 | The `cpu.vm.name` is automatically set when running in a VM with the name of |
| 614 | the VM. A match rule can be written to set custom properties like this: |
| 615 | |
| 616 | ```css |
| 617 | # ~/.config/pipewire/pipewire.conf.d/custom.conf |
| 618 | |
| 619 | context.properties.rules = [ |
| 620 | { matches = [ { cpu.vm.name = !null } ] |
| 621 | actions = { |
| 622 | update-props = { |
| 623 | # These overrides are only applied when running in a vm. |
| 624 | default.clock.min-quantum = 1024 |
| 625 | } |
| 626 | } |
| 627 | } |
| 628 | } |
| 629 | ``` |
| 630 | |
| 631 | # NODE RULES @IDX@ pipewire.conf node.rules |
| 632 | |
| 633 | The node.rules are evaluated every time the properties on a node are set |
| 634 | or updated. This can be used on the server side to override client set |
| 635 | properties on arbitrary nodes. |
| 636 | |
| 637 | `node.rules` provides an `update-props` action that takes an object with |
| 638 | properties that are updated on the node object. |
| 639 | |
| 640 | Add a `node.rules` section in the config file like this: |
| 641 | |
| 642 | ```css |
| 643 | # ~/.config/pipewire/pipewire.conf.d/custom.conf |
| 644 | |
| 645 | node.rules = [ |
| 646 | { |
| 647 | matches = [ |
| 648 | { |
| 649 | # all keys must match the value. ! negates. ~ starts regex. |
| 650 | client.name = "jack_simple_client" |
| 651 | } |
| 652 | ] |
| 653 | actions = { |
| 654 | update-props = { |
| 655 | node.force-quantum = 512 |
| 656 | } |
| 657 | } |
| 658 | } |
| 659 | ] |
| 660 | ``` |
| 661 | |
| 662 | Will set the `node.force-quantum` property of `jack_simple_client` to 512. |
| 663 | |
| 664 | # DEVICE RULES @IDX@ pipewire.conf device.rules |
| 665 | |
| 666 | The device.rules are evaluated every time the properties on a device are set |
| 667 | or updated. This can be used on the server side to override client set |
| 668 | properties on arbitrary devices. |
| 669 | |
| 670 | `device.rules` provides an `update-props` action that takes an object with |
| 671 | properties that are updated on the device object. |
| 672 | |
| 673 | Add a `device.rules` section in the config file like this: |
| 674 | |
| 675 | ```css |
| 676 | # ~/.config/pipewire/pipewire.conf.d/custom.conf |
| 677 | |
| 678 | device.rules = [ |
| 679 | { |
| 680 | matches = [ |
| 681 | { |
| 682 | # all keys must match the value. ! negates. ~ starts regex. |
| 683 | device.name = ""v4l2_device.pci-0000_00_14.0-usb-0_1.2_1.0 |
| 684 | } |
| 685 | ] |
| 686 | actions = { |
| 687 | update-props = { |
| 688 | device.description = "My Webcam" |
| 689 | } |
| 690 | } |
| 691 | } |
| 692 | ] |
| 693 | ``` |
| 694 | |
| 695 | Will set the `device.description` property of the device with the given `device.name` |
| 696 | to "My Webcam". |
| 697 | |
| 698 | |
| 699 | # AUTHORS |
| 700 | |
| 701 | The PipeWire Developers <$(PACKAGE_BUGREPORT)>; |
| 702 | PipeWire is available from <$(PACKAGE_URL)> |
| 703 | |
| 704 | # SEE ALSO |
| 705 | |
| 706 | \ref page_man_pipewire_1 "pipewire(1)", |
| 707 | \ref page_man_pw-mon_1 "pw-mon(1)", |
| 708 | \ref page_man_libpipewire-modules_7 "libpipewire-modules(7)" |
| 709 | \ref page_man_pipewire-pulse_conf_5 "pipewire-pulse.conf(5)" |
| 710 | \ref page_man_pipewire-client_conf_5 "pipewire-client.conf(5)" |