Volume icon in the OSC did not update when mute toggled or
volume changed while playback was paused and mouse was idle.
This commit adds observers for mute and volume properties to
request_tick(), ensuring OSC updates immediately on mute or
volume changes, even if playback is paused and mouse is idle.
On some compositors, when all touch points disappear the compositors
reset the mouse position, which moves the mouse out of the osc element
trigger area so mouse up events do not happen.
Fix this by tracking the last touch position and use that as the virt
mouse position if the screen is recently touched.
f676a9ff20 changed some append_property
calls to append, but append does not support the exclusion feature
which results in "HW: no" shown when no hwdec is active when this
was not displayed before.
Fix this by adding option to append_property to use get_property_cached.
Fixes: f676a9ff20
case_sensitive originally only affected Tab completion. It defaulted to
yes outside of Windows just to emulate the bad defaults of bash and zsh
(not fish, which has better defaults and defaults to case-insensitive
completion). This was already silly, but then it affected the fuzzy
autocompletion and case-sensitive fuzzy completion is even more silly.
And since 0b3cc3a167, it accidentally stopped affecting even that,
because the completion via script message never checked for the option.
Nobody even noticed this, meaning that nobody was relying on fuzzy
autocompletion being case-sensitive.
Just make case_sensitive only affect the new exact search, and make it
default to no on all platforms. Though IMO the search could just always
be case-insensitive.
Allow matching items exactly instead of fuzzily when prefixing the
search with ' (like in fzf) or with
--script-opt=console-exact_match=yes.
This is mainly useful to filter history entries chronologically.
You can also specify multiple search terms delimited by spaces. But '
makes every term an exact match, unlike fzf where you need to place it
before every word, since we can't hook into fzy's algorithm.
Closes#14587.
Disables perf graphs from stats.lua. They are relatively expensive to
render, causes a lot of memory to be used for caches which are never
reused because graph is rarely the same. And most importantly those
graphs are not that useful beyond quick visual inspection of jitter.
Can be enable in script-opt if needed. Cache graph is left enabled,
because it shows if cache readhead grows or not nicely.
Calling input.select() without a prompt argument was failing due to
attempting to concatenate a nil value.
Before mpv 0.40 the prompt defaulted to ">" so this is expected to
work as evident from the example code.
Some properties can take a long time to query, especially those which
require voctrl like current-window-scale and display-names.
Similar to d37521b5ef, make the script
observe these properties and cache the values to avoid querying them
on every refresh. This alleviates the issue when holding down "i" key
for a while and releasing it results in stats being stuck on display
for a long time because of the time required to query there properties.
With -v -v there was an infinite loop of log messages, because every new
logged script message to console triggers a new script message, which
gets logged again.
Sometimes when opening a YouTube video with chapters, the chapter-list
ended up having all the chapters twice, despite the json from yt-dlp only
containing them once. That must mean that sometimes add_single_video()
runs twice before the chapter_list table gets cleared in the
on_preloaded hook.
This can be avoided by replacing chapter_list with a new table before
adding entries to it.
When the first chapter is not at the start of the file but after the
current time position, the chapter property is -1, which prevented
displaying any chapter.
Fixes#16073.
In retrospect, this isn't so great because not neccesarily everyone
would want the mouse to show with the menu and said menu can be
navigated with the keyboard anyway.
This reverts commit a8f5beb5a3.
This is an improvement on #15145 .
If the cursor is automatically hidden, users may not know whether
they are clicking on the inside or outside of selectable items,
the result after clicking is unclear to them.
Pressing ctrl+c in select mode crashes if console wasn't opened in
free-form text mode before.
This also makes the type of the history variable clear.
Fixes a6024b562a.
Those properties are already observed and trigger update, remember the
value to avoid re-fetching them.
This fixes delay caused by properties that synchronize GUI thread like
`focused` which takes 30+ ms in certain cases.
Co-authored-by: Guido Cella <guido@guidocella.xyz>
script-message-to commands type was passing cursor_position as a string,
which caused a crash if you e.g. moved the cursor afterwards. Convert it
to number in console so commands.lua and similar clients don't have to
manually convert it.
Currently --osd-font is the default for select, and a monospace font is
the default for free-form text mode. We can also default to the
proportional --osd-font for mp.input.get clients that don't specify
completions and thus don't need alignment, which is most clients.
In builtin scripts, this is the case for filtering stats key bindings.
With script-message-to commands type, instantly show completions if
available. Useful e.g. with loadfile or apply-profile.
This also shows completions if you just close the console with a filled
line and reopen it.
It was suggested by CogentRedTester in
https://github.com/mpv-player/mpv/pull/10282#issuecomment-1858727729 and
https://github.com/mpv-player/mpv/pull/10282#issuecomment-1858809580 and
by avih that making running commands an mp.input client is a better
architecture.
A practical advantage is that completions are calculated in a different
thread, which prevents hanging when completing slow/network filesystems.
script-binding console/enable becomes script-binding commands/open,
though the console one is kept as an alias. I took the opportunity to
rename this because open makes more sense for a graphical modal, and it
is the word used in mp.input and user-data.
script-message-to console type becomes script-message-to commands type,
though the console one is kept as an alias. It is also changed to
automatically close on submit without having to append '; keypress ESC'
as you don't need to keep the console open after running prefilled
commands.
Also convert to double quotes like other scripts and rename some
inconsistent functions.
Let the complete callback return the character to append to the selected
completion.
I didn't want to document this because it's specifically meant for
properties and unlikely to be needed by other scripts, but silently
interpreting the 3rd return value can screw you over if you do something
like
return candidates, code:find('[%w_]*$')
I was doing this in my lua-repl script, and find() returns the end
position as the 2rd argument, this becomes the 3rd return value and gets
appended to completions. So you have to do
return candidates, code:find('[%w_]*$'), nil
Needed to split running commands out of console.lua.
This increases the priority from 50 (which is neutral) to ensure that
profiles are applied before other scripts.
In general, applying profiles before other scripts makes sense. This was
already the case for external scripts with default priority because they
would load after auto_profiles.
This commit primarily fixes ytdl_hook.lua to respond to profile changes.
In most cases, profile conditions are triggered by external conditions,
not the output from the ytdl hook, so this is fine.
I acknowledge that this will change the order if a script previously had
a priority lower than 50. However, injecting itself before profiles are
evaluated is a very obscure use case, if there is even a valid one.