Skip to content

Commit

Permalink
DOCS/man/lua.rst: document custom arg for mp.add_key_binding()
Browse files Browse the repository at this point in the history
  • Loading branch information
na-na-hi committed Nov 18, 2024
1 parent 3444a0f commit 573274c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions DOCS/man/lua.rst
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
Return the current mpv internal time in seconds as a number. This is
basically the system time, with an arbitrary offset.

``mp.add_key_binding(key, name|fn [,fn [,flags]])``
``mp.add_key_binding(key, name|fn [,fn [,flags, [arg]]])``
Register callback to be run on a key binding. The binding will be mapped to
the given ``key``, which is a string describing the physical key. This uses
the same key names as in input.conf, and also allows combinations
Expand Down Expand Up @@ -316,7 +316,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
or pass the ``fn`` argument in place of the name. The latter is not
recommended and is handled for compatibility only.)

The last argument is used for optional flags. This is a table, which can
The last argument is used for optional parameters. This is a table, which can
have the following entries:

``repeatable``
Expand All @@ -327,6 +327,11 @@ The ``mp`` module is preloaded, although it can be loaded manually with
If set to ``true``, enables key scaling for this specific binding.
This option only makes sense when ``complex`` is set to ``true``.

``arg``
A user-provided string which is available in the table argument of
``fn`` by default.
This option only makes sense when ``complex`` is set to ``true``.

``complex``
If set to ``true``, then ``fn`` is called on key down, repeat and up
events, with the first argument being a table. This table has the
Expand Down Expand Up @@ -358,6 +363,11 @@ The ``mp`` module is preloaded, although it can be loaded manually with
The scale of the key, such as the ones produced by ``WHEEL_*``
keys. The scale is 1 if the key is nonscalable.

``arg``
User-provided string in the ``arg`` argument, or the ``arg``
in the ``script-binding`` command if the key binding is invoked
by that command.

Internally, key bindings are dispatched via the ``script-message-to`` or
``script-binding`` input commands and ``mp.register_script_message``.

Expand Down

0 comments on commit 573274c

Please sign in to comment.