Commit Graph

3891 Commits

Author SHA1 Message Date
Guido Cella
996e58a738 stats.lua: only reprint stats on video-reconfig when toggled
Make this behave like the comment says it should, because currently when
you show oneshot stats and change file, stats are printed again and hide
--osd-playing-msg. This happens even if you hide the stats by
show-texting something else and change file before the timer expires.
2025-01-05 00:52:49 +01:00
Guido Cella
2e1bc3cf26 osc.lua: allow adding custom buttons 2025-01-05 00:50:35 +01:00
Guido Cella
9db941ff8f osc.lua: add cache_enabled() helper 2025-01-05 00:50:35 +01:00
Guido Cella
0d9763872c stats.lua: fix page 2 and 0 layout
Fixes d84e1b3582.
2025-01-04 20:45:31 +01:00
Guido Cella
d84e1b3582 stats.lua: inherit --osd-shadow-offset
Unlike font and border sizes, the default stats shadow offset is 0 like
--osd-shadow-offset, so it can be inherited from it by default to not
make users configure it in 2 places.

Since 0 and negative numbers are valid offsets, use infinity as the
placeholder for unconfigured values.
2025-01-04 20:07:49 +01:00
Guido Cella
2dcf69655a console.lua: complete playlist-play-index none 2025-01-04 16:52:01 +01:00
Guido Cella
6f8d8a38c4 console.lua: apply --osd-selected-color to selected completions 2025-01-04 16:22:20 +01:00
Kacper Michajłow
96da0cbcbd options: remove the player argument from --media-controls
It is now handled internally by the libmpv profile.

Since `player` was the default option, the impact should be minimal, as it
is uncommon to override the default option with the same value.
yes/no args will function the same way as before this commit.
2025-01-04 15:16:40 +01:00
Kacper Michajłow
59d1dc43b9 various: fix typos 2025-01-04 15:59:49 +02:00
Kacper Michajłow
efcee92d0e various: remove double new line at the end of file 2025-01-04 15:59:49 +02:00
Guido Cella
3f084477ad osc.lua: bind middle clicking play pause to cycle loop-playlist 2025-01-03 21:08:28 +01:00
Guido Cella
c9a99db26c console.lua: don't set the cursor color
This makes no visible difference, only the border color is visible, as
the border is drawn on top of the regular color.
2025-01-03 13:02:10 +01:00
Guido Cella
ab25b3d852 console.lua: inherit --osd-back-color in the cursor
3dcc661de7 made the cursor reset to Default style to not apply the blur,
but \blur0 achieves that without resetting every user style. The cursor
can thus respect the user's --osd-back/shadow-color.
2025-01-03 13:02:10 +01:00
Guido Cella
2ecbe8d83b console.lua: inherit --osd-color in the cursor
Following up 19537a4996, also respect the user-specified color in the
cursor. But the cursor is drawn as a border, so we actually need to use
--osd-color as the border color.
2025-01-03 13:02:10 +01:00
Guido Cella
4e8452aee8 console.lua: inherit --osd-shadow-offset
It was requested in
https://github.com/Samillion/ModernZ/issues/259#issuecomment-2556608926
to make console's shadow offset consistent with --osd-shadow-offset. Not
specifying shadow offsets achieves that. This disables console's shadow
by default but there is no reason console should default to having
shadows but the rest of the OSD shouldn't. Users who want shadows can
enable them in the whole OSD with --osd-shadow-offset. console-specific
shadow_{x,y}_offset script-opts can be added if someone requests them
later.
2025-01-03 12:56:10 +01:00
Guido Cella
f21b3f8f06 console.lua: inherit --osd-back-color
The previous commit changed --osd-back/shadow-color to nearly the same
one console was using. This allows unhardcoding it from there and using
--osd-back-color even with --osd-border-style=outline-and-shadow for
consistency with the rest of the OSD.
2025-01-03 12:18:03 +01:00
Guido Cella
00ff6e5ae2 console.lua: remove useless assignment
The lines in populate_log_with_matches()

if selected_match < first_match_to_print then
    first_match_to_print = selected_match

will set first_match_to_print to 1 even if it is not set here since
handle_edit() sets selected_match = 1.
2025-01-03 11:25:22 +01:00
Guido Cella
f3ed94b74d console.lua: focus the default item after emptying the input line
When console is opened with selectable items and a default item, the
default item is placed at the center. But if you type something and then
clear the line, the first item becomes the selected one. Make it select
the default item and place it in the center in this case too.
2025-01-03 11:25:22 +01:00
Guido Cella
50a3da73b7 select.lua: fix select-edition crash on non-MKVs
In files other than MKVs edition-list is an empty table, not nil. It is
current-edition that is nil.

However nil still needs to be checked to not crash with mpv --idle.
2024-12-31 10:13:38 +01:00
Dudemanguy
a2fe5ee900 player/video: fallback to audio sync logic if VO is not visible
The previous commit put all the pieces in place so now this can be
implemented. Scheduling frames is already written with the assumption
that display sync maybe turn on/off at any time. So all that needs to be
done is check if the VO reports that it is not visible. If so, simply
flip mpctx->display_sync_active to false for that frame and skip the
display sync frame handling. It will become true again when the mpv
window comes back into view.
2024-12-28 16:51:28 +00:00
Kacper Michajłow
7562a798b1 player/osd: use fixed width for vsync-ratio value in status line
Makes status line more stable, without variable width.
2024-12-28 14:33:34 +01:00
Guido Cella
0417218daa console.lua: don't highlight the first completion with mp.input.get
The first completion is highlighted because it is automatically inserted
when pressing Enter, but this isn't the case when the console is used
with mp.input.get, and autoselecting it can be undesirable if you're
entering arbitrary text, unlike with mpv commands where you're usually
choosing from predefined lists. So just don't highlight the first
completion for mp.input clients.
2024-12-28 14:31:44 +01:00
Guido Cella
bd150a4d8d console.lua: keep --osd-{,outline}-color's alpha component for styles
There is no need to override this for colored lines.
2024-12-28 14:13:46 +01:00
Guido Cella
61aa8200ad console.lua: complete clipboard/text 2024-12-28 14:09:07 +01:00
der richter
d389c06646 console.lua: use native clipboard property on macOS 2024-12-24 16:11:45 +01:00
der richter
026f1fb61d clipboard-mac: add macOS clipboard backend 2024-12-24 16:11:45 +01:00
der richter
2b06728df9 command: add ambient-light property
make it observable to make it usable as a replacement for --gamma-auto.
2024-12-21 16:15:44 +01:00
Guido Cella
38c46e4d89 stats.lua: enable runtime script-opt changes
This doesn't work for changing page key script-opts at runtime because
they are used as the indexes of the pages variable, but nothing actually
breaks if you do, it just uses the initial values. This is still useful
for conditionally changing sizes at runtime or for trying out the
osd-box profile by applying it from the console.
2024-12-20 14:54:20 +00:00
Guido Cella
19537a4996 console.lua: inherit --osd-color and --osd-outline-color
Stop overriding the OSD font and outline color in the console input line
and log, except for the lines already in a different color. This allows
configuring the console color and makes it consistent with the rest of
the OSD, like 51bd00c33a did for stats.
2024-12-20 14:54:08 +00:00
Guido Cella
661a380fda console.lua: color the default item with --osd-selected-color
Currently if you change --osd-selected-color the preselected item stays
yellow and can't be changed. Since the default item style was just
chosen from the selected color without the bold, also make the default
item follow --osd-selected-color.

Requested in
https://github.com/Samillion/ModernZ/issues/259#issuecomment-2556608926.
2024-12-20 12:43:34 +01:00
yk
96fad6a0fc ytdl_hook: pass empty proxy value
an empty value to a commandline option usually means that parameter does
not expect anything, but in case of `--proxy`, yt-dlp use an empty value to
disable proxy setting, the empty value need to be passed to `--proxy`
2024-12-17 22:26:46 +02:00
Guido Cella
e52f975842 osc.lua: simplify track ID retrival
When track IDs are auto mp.get_property_native() returns "auto", but
mp.get_property_number() returns nil.

Follow up to 1a558bf5c2 and 897c04afe1.
2024-12-13 18:46:53 +01:00
Guido Cella
5e4b825a48 select.lua: abort edition selection when there's only 1
MKVs have 1 edition by default so don't show an empty edition selection
in that case.
2024-12-13 03:46:03 +01:00
Guido Cella
cac6b663c7 osc.lua: show the full path when right clicking the title
Right clicking playlist arrows already opens the playlist selector so
bind something else to right clicking the title. Make it show the full
path which is useful but not bound anywhere on either the keyboard or
the OSC.
2024-12-12 21:54:44 +01:00
Guido Cella
365a33badd osc.lua: open the playlist selector when right clicking playlist arrows
- It makes more sense to select a playlist entry from the buttons that
  navigate the playlist than from the title
- Provides different bindings for right and middle click
- Mirrors chapter button bindings
2024-12-12 21:54:44 +01:00
Guido Cella
f4a35a0264 osc.lua: move title mbtn script-opts below playlist_next's
Sort mbtn script-opts according to how they are shown to the user in bar
layout instead of how they are defined in osc_init().
2024-12-12 20:35:55 +01:00
Dudemanguy
a7f6460e7e player/audio: get rid of bogus early return in reinit_audio_filters
There is a condition here that is supposed to wait until the ao is
finished playing before it goes through the rest of this function and
actually starts the reinit of the audio chain. This is not needed
however and actually causes a bug. uninit_audio_out already takes the
gapless audio case into account and drains the audio before preceding.
There is no reason to bail here. Additionally, returning early here
actually breaks ao_alsa. ao_alsa is pretty dumb and not able to cope
with changing samplerates. It explictly needs to stop the PCM and then
start it again for it to work. The old code here ensured the ao would
never reinit itself and then would wait forever trying to play samples
with no actual data. Other AOs (pipewire and pulse) seem to be able to
cope with this and reinit themselves in other ways (didn't look in
detail). This change makes no difference for them. Note that in many
cases, this appeared to work on ALSA because there is a high likelihood
that your default audio device will choose a 48 kHz sampling rate and
thus your entire playlist is resampled to 48 kHz which avoids the
bug.

Fixes #15477.
2024-12-11 17:12:22 +00:00
Guido Cella
2dd5bd4cd1 osc.lua: draw box layout below console
console is drawn below the OSC. This looks bad only with layout=box
because there is no user-data/osc/margins so it overlaps with it. Fix it
by using z -1 with box layout.

Follow up to 86d24b0 and 9c22d6b.
2024-12-11 17:51:16 +01:00
Jisu Kim
e2014fb309 osc.lua: add option to enable fade-in effect
Introduced a new `fadein` option to control the fade-in effect for the OSC.
The default value is `no`, which disables fade-in. This option allows users
to enable a fade-in effect when the OSC appears. Updated documentation
accordingly.
2024-12-10 22:41:40 +01:00
Guido Cella
8d76ff79a3 console.lua: rename dimension variables
These are easier to read with _ between words. Also screenx/y could be
assumed to be display coordinates, so rename them to osd_w/h. They are
not named osd_width/osd_height to avoid Redefined local LSP warnings
with the ones in the upper scope.
2024-12-10 22:21:31 +01:00
nanahi
65328563e7 command: signal unavailable error when clipboard is unavailable
This allows clients to detect if the clipboard is unavailable,
or an error happened.
2024-12-10 14:20:08 +01:00
nanahi
e121c092b4 clipboard-vo: make logging verbose when clipboard is unavailable
It now only warns when the clipboard is implemented but get/set
failed. This is consistent with other properties like current-vo.
2024-12-10 14:20:08 +01:00
nanahi
e62503cb39 clipboard: add CLIPBOARD_UNAVAILABLE error code
This makes it possible to distinguish between unavailable
or unsupported, and error.
2024-12-10 14:20:08 +01:00
Guido Cella
7bae5b8d37 console.lua: clear completions before searching history 2024-12-10 14:18:51 +01:00
Guido Cella
7253b6c63d console.lua: remove code repetition to initialize matches 2024-12-10 14:18:51 +01:00
Guido Cella
5dbaa69138 console.lua: add margin_{x,y} script-opts
Allow configuring the margins from the left bottom indipendently of
--osd-margin-{x,y}.

Fixes #15478.
2024-12-10 13:47:43 +01:00
Guido Cella
0bb1659cd6 configfiles: refactor mp_get_playback_resume_config_filename()
This avoids duplicating fname when it is a URL.
2024-12-09 19:23:03 +01:00
Guido Cella
a5fa862a44 configfiles: don't use the basename of urls
With --ignore-path-in-watch-later-config the basename of files is used
for watch later files, but since 1d640c9887 this was checking the wrong
variable to determine if the file is a URL and thus also taking the
basename of URLs, when URLs should use the full path regardless of this
option.
2024-12-09 19:23:03 +01:00
Guido Cella
94135b1245 console.lua: don't override --osd-bold in completions
Respect the OSD bold style in completions printed after the selected
one.

Fixes #15452.
2024-12-09 19:21:33 +01:00
Kacper Michajłow
4747865fef player/command: continue hook processing on errors
If a hook fails to invoke or a client has been removed during hook
processing, attempt to continue with the next hook if possible.

Before this commit, any failure during hook processing would cause the
hook processing to stop.

This issue can be reproduced when auto_profiles.lua registers an on_load
hook and exits afterward because no profiles are registered. In such a
state, the next hook would fail and not invoke.

There are many scenarios where a hook client may be broken,
unresponsive, or disabled, so it makes sense to continue processing
subsequent hooks.

The regression we observed was caused by e2284fba1 and 5dc404741, which
made auto_profiles.lua register hooks and then exit, leaving stale hooks
registered. However, the root cause is not limited to the
auto_profiles.lua case.

Fixes: #15465
2024-12-09 19:20:38 +01:00