This removes wireplumber's state files and optionally also config
files of both wireplumber and pipewire. The purpose of it is to reset
the state easily to the distribution's defaults, as if it's the first
run right after installation.
Fixes: #397
Scripts are always deactivated (and not finalized) before core disconnects, so
we need to make sure the scripts don't hold a strong reference when creating
them. They must only hold a strong reference of the Lua state if activated.
In order to implement this properly, the lua_State has been wrapped into a
GObject so that the 'lua-engine' construct-only property is a weak reference of
the Lua state. Then, when the script is activated, a strong reference of the Lua
state is held so the script can work. This strong reference is later dropped
when the script is deactivated (right before the core is disconnected), avoiding
leaked proxy warning messages in the log if a script has a global variable
holding a proxy (Eg the alsa monitor in alsa.lua).
While testing this script I've found out that all profiles on my device
have "unknown" availablility rather than "yes", so they were skipped.
Fix by changing the check to not-"no".
While here, add more debug logging that would've helped debug this,
and fix the indentation on one line where it was off.
Add wp_client_get_permission_manager() and
wp_permission_manager_get_default_permissions() and expose both as Lua
methods. This allows Lua scripts to verify a client's trust level at
runtime by inspecting the actual permission bits of its attached PM.
The PW daemon can gate portal clients on stolen-fd reconnect by
removing PW_PERM_R from PW_ID_CORE, but only when the session manager
advertises support so set pipewire.access.portal.gate-supported on
portal clients before the async PermissionManager activation so it is
present by the time the portal steals the fd.
Fixes: #941
This setting will use the best quality or latency profiles for BT devices if
available. HSP/HFP profiles will always be ignored. The setting is a string that
only accepts 'quality' and 'latency' strings. Any other value will be treated
the same way as the 'quality' value.
The core object (ID 0) is implicit in the PipeWire connection and never
appears in the permission manager's ObjectManager. Add a
core_permissions field to set explicit permissions on it independently
of default_permissions.
This is suspected to be the reason why the CI pipelines fail on some
of the linking tests. Reverting the commit for now, until the issue
is better understood.
See #934
This reverts commit 529aaa66cb.
The refactoring uses a new 'select-access' event to select the access for each
client with a fallback mechanism. The fallback priority is: configuration,
flatpak, snap, portal, and default.
The access JSON configuration has also been improved so that users can create
their custom permission managers and attach them to any client. See the access
configuration example for more information describing how to do this.