13 Commits

Author SHA1 Message Date
Guido Cella e046cd0736 context_menu.lua: add background_alpha script-opt
Closes #17807.
2026-04-24 20:19:50 +02:00
Hubert Głuchowski ac3b6044d0 console.lua: use terminal_display_width when picking longest menu item
Previously this function would just count bytes which was very easily
broken by incantations like `Ő̶̧͍̹͔̮̮̦͌̈̌̂́̊͜K͖̮̼̯͖͆͋̓̀̕` which take up 52 bytes while being just
2 normal width characters visually.

`terminal_display_width` correctly counts `Ő̶̧͍̹͔̮̮̦͌̈̌̂́̊͜K͖̮̼̯͖͆͋̓̀̕` as 2 visual characters.

Note: GitHub strips all these in their web UI but there are many Unicode
combining characters after each letter of the `OK`s above that produce
a "cursed" text effect.

Fixes #17772
2026-04-21 18:17:22 +02:00
Guido Cella aec426a4d8 context_menu.lua: set user-data/mpv/context-menu/open
Closes #17428.
2026-04-17 19:46:12 +02:00
Guido Cella ec4d50fd91 context_menu.lua: enable runtime script-opt updates
Fixes #17726.
2026-04-09 13:40:37 +02:00
Guido Cella 2cef09820d context_menu.lua: apply disabled_color to separators
As per Samillion's suggestion, reduce the contrast between separators
and the background to match other context menus. Using the already
defined disabled_color works for this and seems to be what GTK and Qt
do at a glance.
2026-01-31 13:20:05 +01:00
Guido Cella d7f0efb67b context_menu.lua: make ESC close only submenus when they are open
Fixes https://github.com/mpv-player/mpv/pull/17316#issuecomment-3798278219
2026-01-26 10:50:50 +01:00
Guido Cella 70d3dc58e8 context_menu.lua: activate key hints with caps lock
Fixes https://github.com/mpv-player/mpv/pull/17316#issuecomment-3797615909
2026-01-26 10:32:05 +01:00
Guido Cella e99a9168c1 context_menu.lua: implement key hints
When a character in an item's title is preceded by &, underline it and
activate the item when pressing the character.

Cycling between multiple items with the same hint is not supported.

&& escapes & so it works like the Windows context menu.

Hints after &&&, or greater odd numbers of &, are not supported since
Lua patterns don't support {n,m} quantifiers.
2026-01-25 05:21:49 +01:00
Guido Cella e2bd1c6a88 {console/context_menu}.lua: don't apply --osd-blur to menu backgrounds 2025-10-29 15:36:35 +01:00
Guido Cella 0a53407a48 context_menu.lua: prevent some rare crashes
Fix crashes that won't happen in regular usage:

- If you open the menu with an empty menu-data and use keybindings
- If you open the menu with menu-data only containing hidden items
- If you invoke script-message-to context_menu select with the menu
  closed
2025-10-11 10:32:29 +02:00
Guido Cella 6e8283d377 context_menu.lua: add a missing return
The space key selects the current item so it shouldn't also try to
activate items with titles starting with space.
2025-10-11 10:32:29 +02:00
Guido Cella cabee53ebd context_menu.lua: make gap a percentage of the font_size
Avoids having to update the gap for most users who just want to change
the font size.
2025-09-27 19:26:54 +02:00
Guido Cella 8406834075 context_menu.lua: add this script
This implements a ASS context menu to be used on platforms other than
Windows.

The select script message will allow selecting an item with a single
click when releasing a mouse button, like in native context menus. This
is mainly useful to cycle pause with one click.
2025-09-15 04:12:57 +02:00