Skip to content

Instantly share code, notes, and snippets.

@bassmanitram
Created March 11, 2023 12:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bassmanitram/8e13230910b901a9be4bd979763be902 to your computer and use it in GitHub Desktop.
Save bassmanitram/8e13230910b901a9be4bd979763be902 to your computer and use it in GitHub Desktop.
How to make PipeWire prevent an application from adjusting sound settings
--
-- Prerequisites: you are using PipeWire, WirePlumber is your session manager, and you
-- are using a per-user configuration. These preconditions are fulfilled in Pop!OS 22_04.
--
-- It does not matter what API the PipeWire client is using to interact with PipeWire - Pulse,
-- Jack, ALSA, Native - this works in all cases.
--
-- Put this file in $HOME/.config/wireplumber/main.lua.d, then restart the services related
-- to PipeWire - "systemctl --user restart wireplumber pipewire pipewire-pulse"
--
-- This specific example stops any Ferdium client from messing with sound settings - sink or source.
-- There are many other "matches" that you can use to target specific clients. For example, you COULD
-- target only microphone changes comming from Ferdium, by adding to the matches
--
-- { "application.name", "=", "Chromium input" },
--
-- To find the IDs of clients attached to PipeWire via WirePlumber, use "wpctl status"
-- To list the properties of a client (that can be used in match constraints), use "wpctl inspect <client-id>"
--
-- The WirePlumber feature that this file messes with is "access" - specifically the default_access table.
-- This is described here https://pipewire.pages.freedesktop.org/wireplumber/configuration/access.html which also
-- links to this document https://pipewire.pages.freedesktop.org/wireplumber/configuration/alsa.html
-- which describes the syntax of the "matches" block.
--
-- Note that clients have a property named pipewire.access - this is NOT the permissions GRANTED, it is the
-- permissions that the client has requested. The code below will not change this string - but WILL restrict
-- the permissions of the client to being able to stream to/from, and read the status of, devices, but not to
-- change the properties of the device
--
table.insert (default_access.rules,
{
matches = {
{
{ "application.process.binary", "=", "ferdium" },
}
},
default_permissions = "rx",
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment