diff --git a/docs/rst/daemon/locations.rst b/docs/rst/daemon/locations.rst index 0160ae86..0e4e042b 100644 --- a/docs/rst/daemon/locations.rst +++ b/docs/rst/daemon/locations.rst @@ -97,6 +97,8 @@ the parsing order matters in merging. See :ref:`config_conf_file_fragments` fragment files are *only* looked up in the directories specified by this variable. +.. _config_locations_scripts: + Location of scripts ------------------- diff --git a/docs/rst/index.rst b/docs/rst/index.rst index c000715c..06315bd1 100644 --- a/docs/rst/index.rst +++ b/docs/rst/index.rst @@ -42,6 +42,7 @@ Table of Contents scripting/lua_api.rst scripting/existing_scripts.rst + scripting/custom_scripts.rst .. toctree:: :maxdepth: 2 diff --git a/docs/rst/scripting/custom_scripts.rst b/docs/rst/scripting/custom_scripts.rst new file mode 100644 index 00000000..6f1573b1 --- /dev/null +++ b/docs/rst/scripting/custom_scripts.rst @@ -0,0 +1,41 @@ +.. _scripting_custom_scripts: + +Custom Scripts +============== + +The locations where WirePlumber searches for scripts is explained in +:ref:`config_locations_scripts`. + +Scripts are not loaded automatically; a component muse be defined for them, and +this component must be included in a profile. See +:ref:`config_components_and_profiles`. + +Full example +------------ + +Let's assume that ``~/.local/share/wireplumber/scripts/90-hello-world.lua`` +contains the following script: + +.. code-block:: lua + + log = Log.open_topic("hello-world") + log.info("Hello world") + +In order for it to run, we'll define a component and include it in the default +profile by including the following configuration (for example, in +``~/.config/wireplumber/wireplumber.conf.d/90-hello-world.conf``): + +.. code-block:: + + wireplumber.components = [ + { + name = "90-hello-world.lua", type = script/lua + provides = hello-world + } + ] + + wireplumber.profiles = { + main = { + hello-world = required + } + } diff --git a/docs/rst/scripting/meson.build b/docs/rst/scripting/meson.build index e6324f49..819e7dc4 100644 --- a/docs/rst/scripting/meson.build +++ b/docs/rst/scripting/meson.build @@ -2,6 +2,7 @@ sphinx_files += files( 'lua_api.rst', 'existing_scripts.rst', + 'custom_scripts.rst', ) subdir('lua_api')