Commit Graph

3866 Commits

Author SHA1 Message Date
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
Kacper Michajłow
e9af4092e9 player/configfiles: don't loop directory tree if not needed
If we already failed to generate fname, there is no need to try harder.
2024-12-09 19:20:25 +01:00
Guido Cella
78ee714fff console.lua: fix mp.input.get clients that don't specify completions
Actually update the rendered text when typing with an input.get client
that didn't specify a complete callback.

Fixes #15430, fixes 57b73f1af6.
2024-12-03 14:59:53 +01:00
Guido Cella
43f4568816 select.lua: select editions 2024-12-02 21:44:18 +01:00
Guido Cella
063410fa04 console.lua: don't reinsert the next characters on complete
This avoids inserting the characters in front of the cursor again when
completing to text already in front of the cursor.

This is important after 2f271a92de made Enter automatically insert the
first completion.
2024-12-02 20:57:01 +01:00
Guido Cella
9d67fc28e2 console.lua: don't complete DLLs on Windows
run completion on Windows is slow because system32 contains thousands of
DLLs, so filter executables with an extension in PATHEXT.
2024-12-02 20:56:49 +01:00
Guido Cella
3053797e3c defaults.lua: remove outdated comment
A client's input sections are destroyed along with it since bf385e1140.
2024-12-02 20:51:24 +01:00
Guido Cella
1f1c30146c console.lua: complete executables after run 2024-12-01 19:28:22 +01:00
Guido Cella
43ff1c1af6 console.lua: complete filter labels for {a,v}f-command 2024-12-01 19:28:22 +01:00
Guido Cella
15e7a1184a console.lua: complete command flags 2024-12-01 19:28:22 +01:00
Guido Cella
220de247b8 console.lua: remove code repetition in complete() 2024-12-01 19:28:22 +01:00
Guido Cella
c8d9f37b27 command: fix --osd-selected{,-outline}-color
Using 3 %x in a row can produce colors like 0ff0 which are interpreted
incorrectly, so ensure each colors has 2 digits.
2024-12-01 18:54:50 +01:00
Kacper Michajłow
4ff9f50b6b player/clipboard/clipboard: don't include global.h in header
This header should not be included except when really needed.

Fixes: e1d30c4c5a
2024-11-28 00:45:27 +01:00
nanahi
7899a28699 defaults.js: support custom arg in mp.add_key_binding() 2024-11-27 20:40:41 +01:00
nanahi
06670298b3 defaults.lua: support custom arg in mp.add_key_binding()
The information is available in the table.
2024-11-27 20:40:41 +01:00
nanahi
0874f81b31 command: add custom arg for script-binding
This allows passing arbitrary information in the script-binding
command. The content is available as a new message argument.
2024-11-27 20:40:41 +01:00
nanahi
5fd4bfb4a0 defaults.js: support scalable mp.add_key_binding() 2024-11-27 20:40:41 +01:00
nanahi
e3e22de2ca defaults.lua: support scalable mp.add_key_binding()
For complex key bindings, the table now contains a new member
of the current key scale. mp.add_key_binding() now accepts the
scalable flag to make the binding scalable.
2024-11-27 20:40:41 +01:00
nanahi
34571e7882 command: make script-binding command scalable
script-binding command is currently not scalable, so script
registered key bindings also cannot be scalable, unlink input.conf
bindings.

This makes script-binding command scalable so that it's possible to
define scalable key bindings in scripts. It now calls script-message
command with an extra argument with the scale of the key.
2024-11-27 20:40:41 +01:00
nanahi
510d634b5b console.lua: use native clipboard property on win32 and wayland
Since native clipboard is implemented on win32 and wayland,
use the clipboard property instead.

This fixes the problems with commandline implementations of clipboard:
- On win32, the powershell implementation is complex, and it can take
  several seconds to run for the first time.
- On wayland, it requires wl-paste to be installed, which isn't always
  available. It also works poorly on GNOME.
2024-11-27 20:31:41 +01:00
nanahi
593d437dae command: notify-property command
Since VOCTRL is not suitable for frequent data query
(see 477a0f8318 for details),
it's not suitable to be used by the VO clipboard backend.
Instead, since the VO does the clipboard monitoring by itself,
it can notify the player when the clipboard is updated.

This adds an internal notify-property command so that VOs
can notify player when the clipboard is updated, so that clipboard
monitoring works.
2024-11-27 20:31:41 +01:00
nanahi
625900687e clipboard-win: implement clipboard monitoring
This uses GetClipboardSequenceNumber() to detect clipboard
content changes. Clipboard Format Listener is a better way to
do this according to MS docs, but sequence number works and
the listener requires creating a dedicated thread and HWND
for monitoring, so I will save it for a later time.
2024-11-27 20:31:41 +01:00
nanahi
1d36f7be05 clipboard: add clipboard monitoring API
This adds a clipboard monitoring API for backends which use polling
to monitor clipboard updates. --clipboard-monitor option can turn
clipboard monitoring on and off at runtime.
2024-11-27 20:31:41 +01:00
nanahi
dcde47e15b clipboard-win: add Windows clipboard backend
This adds a Windows clipboard backend. This doesn't depend on
VO, so it can be used even when no video window is created.
2024-11-27 20:31:41 +01:00
nanahi
23b8fb3d9c clipboard-vo: implement VO clipboard backend
This adds a generic VO clipboard backend based on VOCTRLs
to get and set clipboard data.
2024-11-27 20:31:41 +01:00
nanahi
6e848a0b3c command: add clipboard property
This adds clipboard property which uses the clipboard
API to get and set clipboard contents. Currently only
clipboard text is implemented, but this can be extended in
the future to cover primary selection and other formats.
2024-11-27 20:31:41 +01:00