Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ indent_style = unset
indent_size = unset
max_line_length = unset
trim_trailing_whitespace = unset

[menu.conf]
indent_style = tab
1 change: 1 addition & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,5 @@ stds = { mp = { read_globals = mp_globals } }
-- mp_internal seems to be merged with mp for other files too...
files["player/lua/defaults.lua"] = { globals = mp_internal }
files["player/lua/auto_profiles.lua"] = { globals = { "p", "get" } }
files["player/lua/select.lua"] = { globals = { "p", "get" } }
max_line_length = 100
50 changes: 44 additions & 6 deletions DOCS/man/context_menu.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
CONTEXT MENU SCRIPT
===================

This script provides a context menu for platforms without integration with a
native context menu. On these platforms, it can be disabled entirely using the
CONTEXT MENU
============

The context menu is a menu that pops up on the video window. By default, it is
bound to right click.

menu.conf
---------

You can define your own menu in ``~~/menu.conf`` (see `FILES`_), or an
alternative path specified with ``--script-opt=select-menu_conf_path``. It is
recommended to use the default ``menu.conf`` from
https://github.com/mpv-player/mpv/blob/master/etc/menu.conf as an example to get
started.

Each line of ``menu.conf`` is a menu item with fields separated by 1 or more
tabs. The first field is the text shown in the menu. The second field is usually
the command that is run when that item is selected. Fields from the third
onwards can specify ``checked=``, ``disabled=`` and ``hidden=`` states in the
same way as `Conditional auto profiles`_.

When there is no command, the item will open a submenu. Fields below indented
with leading whitespace are added to this submenu. Nested submenu items are
defined by adding more leading whitespace than the parent menu entry.

Empty lines are interpreted as separators.

The second field can also be one of the following tokens to make that entry a
submenu with the relative items: ``$playlist``, ``$video-tracks``,
``$audio-tracks``, ``$sub-tracks``, ``$secondary-sub-tracks``, ``$chapters``,
``$editions``, ``$audio-devices``. These menus are automatically disabled when
empty.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those special things, like tracks are not working, they are not populated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using mpv-menu-plugin? I changed @ to $ so they look more like variables though it is not important

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using mpv-menu-plugin?

Do I need to install it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I was assuming you were using a plugin with a slightly different syntax. I don't know why else they wouldn't work for you as they work just fine with --no-config for me.

Copy link
Member

@kasper93 kasper93 Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know either. I only see

[select] Menu entry "50%" error on evaluating: @select.lua:818: attempt to index local 'name' (a number value)

in log.

How can I help debug this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was an unrelated error in the window scale conditions. Fixed that. Still no idea about the builtin submenus.


To use the native context menu, you need to fill the ``menu-data`` property with
menu definition data, and call the ``context-menu`` command. In builtin scripts,
this is done by ``select.lua``, which parses ``menu.conf`` to populate
``menu-data``. It then calls the ``context-menu`` command on platforms where
integration with the native context menu is implemented, while on platforms
where it is not, it opens ``context_menu.lua``.

On platforms without integration with the native context menu,
``context_menu.lua`` can be disabled entirely using the
``--load-context-menu=no`` option. On platforms where the integration is
implemented, it is already disabled by default.
implemented, it is already disabled by default, and ``--load-context-menu=yes``
will make ``select.lua`` use it.

Script messages
---------------
Expand Down
17 changes: 5 additions & 12 deletions DOCS/man/mpv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,14 @@ g-b
g-r
Show the values of all properties.

g-m, MENU, Ctrl+p
g-m, Ctrl+p
Show a menu with miscellaneous entries.

See `SELECT`_ for more information.

MENU, Shift+F10
Show the context menu (see `CONTEXT MENU`_).

(The following keys are valid if you have a keyboard with multimedia keys.)

PAUSE
Expand Down Expand Up @@ -384,7 +387,7 @@ Left double click
Toggle fullscreen on/off.

Right click
Toggle pause on/off.
Show the context menu (see `CONTEXT MENU`_).

Forward/Back button
Skip to next/previous entry in playlist.
Expand All @@ -399,16 +402,6 @@ Ctrl+Wheel up/down
Change video zoom keeping the part of the video hovered by the cursor under
it.

Context Menu
-------------

Context Menu is a menu that pops up on the video window on user interaction
(mouse right click, etc.).

To use this feature, you need to fill the ``menu-data`` property with menu
definition data, and add a keybinding to run the ``context-menu`` command,
which can be done with a user script.

USAGE
=====

Expand Down
28 changes: 28 additions & 0 deletions DOCS/man/select.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ providing script bindings that gather and format the data to be selected in the
console and do operations on the selected item. It can be disabled using the
``--load-select=no`` option.

This script is also used to populate the context menu.

Key bindings
------------

Expand Down Expand Up @@ -141,6 +143,9 @@ Available script bindings are:
``menu``
Show a menu with miscellaneous entries.

``context-menu``
Show the context menu.

Configuration
-------------

Expand All @@ -161,3 +166,26 @@ Configurable options
Default: yes

Whether to show only the last of history entries with the same path.

``menu_conf_path``
Default: ~~/menu.conf (see `FILES`_).

The path from which to read the custom context menu definition (see `CONTEXT
MENU`_).

``max_playlist_items``
Default: 25

The maximum number of playlist entries in the context menu.

``use_context_menu_script``
Default: auto

Whether to use the native context menu or ``context_menu.lua``.

``auto`` means ``context_menu.lua`` is used with
``--load-context-menu=yes``, and the native context menu is attempted to be
used with ``--load-context-menu=no``.

``yes`` allows using a fork of ``context_menu.lua`` with
``--load-context-menu=no``.
5 changes: 3 additions & 2 deletions DOCS/tech-overview.txt
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,9 @@ sub/:
sd_ass.c's internal state.

etc/:
The files input.conf and builtin.conf are actually integrated into the mpv
binary by the build system. They contain the default configs and keybindings.
The files input.conf, builtin.conf and menu.conf are actually integrated
into the mpv binary by the build system. They contain the default configs
and keybindings.

Best practices and Concepts within mpv
======================================
Expand Down
39 changes: 20 additions & 19 deletions etc/input.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@

#MBTN_LEFT ignore # don't do anything
#MBTN_LEFT_DBL cycle fullscreen # toggle fullscreen
#MBTN_RIGHT cycle pause # toggle pause/playback mode
#MBTN_RIGHT script-binding select/context-menu # show the context menu
#MBTN_BACK playlist-prev # skip to the previous file
#MBTN_FORWARD playlist-next # skip to the next file
#Ctrl+MBTN_LEFT script-binding positioning/drag-to-pan # pan around the clicked point

# Mouse wheels, touchpad or other input devices that have axes
# if the input devices supports precise scrolling it will also scale the
# numeric value accordingly
#WHEEL_UP add volume 2
#WHEEL_UP add volume 2
#WHEEL_DOWN add volume -2
#WHEEL_LEFT seek -10 # seek 10 seconds backward
#WHEEL_RIGHT seek 10 # seek 10 seconds forward
#WHEEL_RIGHT seek 10 # seek 10 seconds forward

## Seek units are in seconds, but note that these are limited by keyframes
#RIGHT seek 5 # seek 5 seconds forward
Expand Down Expand Up @@ -74,13 +74,13 @@
#HOME seek 0 absolute # seek to the start
#PGUP add chapter 1 # seek to the next chapter
#PGDWN add chapter -1 # seek to the previous chapter
#Shift+PGUP seek 600 # seek 10 minutes forward
#Shift+PGUP seek 600 # seek 10 minutes forward
#Shift+PGDWN seek -600 # seek 10 minutes backward
#[ multiply speed 1/1.1 # decrease the playback speed
#] multiply speed 1.1 # increase the playback speed
#{ multiply speed 0.5 # halve the playback speed
#} multiply speed 2.0 # double the playback speed
#BS set speed 1.0 # reset the speed to normal
#BS set speed 1 # reset the speed to normal
#Shift+BS revert-seek # undo the previous (or marked) seek
#Shift+Ctrl+BS revert-seek mark # mark the position for revert-seek
#q quit
Expand All @@ -105,19 +105,19 @@
#? script-binding stats/display-page-4-toggle # toggle displaying key bindings
#` script-binding commands/open # open the console
#z add sub-delay -0.1 # shift subtitles 100 ms earlier
#Z add sub-delay +0.1 # delay subtitles by 100 ms
#x add sub-delay +0.1 # delay subtitles by 100 ms
#ctrl++ add audio-delay 0.100 # change audio/video sync by delaying the audio
#ctrl+- add audio-delay -0.100 # change audio/video sync by shifting the audio earlier
#ctrl+KP_ADD add audio-delay 0.100 # change audio/video sync by delaying the audio
#ctrl+KP_SUBTRACT add audio-delay -0.100 # change audio/video sync by shifting the audio earlier
#G add sub-scale +0.1 # increase the subtitle font size
#Z add sub-delay 0.1 # delay subtitles by 100 ms
#x add sub-delay 0.1 # delay subtitles by 100 ms
#ctrl++ add audio-delay 0.1 # change audio/video sync by delaying the audio
#ctrl+- add audio-delay -0.1 # change audio/video sync by shifting the audio earlier
#ctrl+KP_ADD add audio-delay 0.1 # change audio/video sync by delaying the audio
#ctrl+KP_SUBTRACT add audio-delay -0.1 # change audio/video sync by shifting the audio earlier
#G add sub-scale 0.1 # increase the subtitle font size
#F add sub-scale -0.1 # decrease the subtitle font size
#9 add volume -2
#/ add volume -2
#KP_DIVIDE add volume -2
#0 add volume 2
#* add volume 2
#0 add volume 2
#* add volume 2
#KP_MULTIPLY add volume 2
#m cycle mute # toggle mute
#1 add contrast -1
Expand All @@ -129,8 +129,8 @@
#7 add saturation -1
#8 add saturation 1
#Alt+0 set window-scale 0.5 # halve the window size
#Alt+1 set window-scale 1.0 # reset the window size
#Alt+2 set window-scale 2.0 # double the window size
#Alt+1 set window-scale 1 # reset the window size
#Alt+2 set window-scale 2 # double the window size
#b cycle deband # toggle the debanding filter
#d cycle deinterlace # cycle the deinterlacing filter
#r add sub-pos -1 # move subtitles up
Expand Down Expand Up @@ -173,11 +173,11 @@
#ctrl+w quit
#E cycle edition # switch edition
#l ab-loop # set/clear A-B loop points
#L cycle-values loop-file "inf" "no" # toggle infinite looping
#L cycle-values loop-file inf no # toggle infinite looping
#ctrl+c quit 4
#Ctrl+v loadfile ${clipboard/text} append-play; show-text '+ ${clipboard/text}' # append the copied path
#DEL script-binding osc/visibility # cycle OSC visibility between never, auto (mouse-move) and always
#ctrl+h cycle-values hwdec "no" "auto" # toggle hardware decoding
#ctrl+h cycle-values hwdec no auto # toggle hardware decoding
#F8 show-text ${playlist} # show the playlist
#F9 show-text ${track-list} # show the list of video, audio and sub tracks
#g ignore
Expand All @@ -196,8 +196,9 @@
#g-b script-binding select/select-binding
#g-r script-binding select/show-properties
#g-m script-binding select/menu
#MENU script-binding select/menu
#ctrl+p script-binding select/menu
#MENU script-binding select/context-menu
#Shift+F10 script-binding select/context-menu

#Alt+KP1 add video-rotate -1 # rotate video counterclockwise by 1 degree
#Alt+KP5 set video-rotate 0 # reset rotation
Expand Down
Loading
Loading