mirror of
https://github.com/mpv-player/mpv
synced 2025-04-25 12:50:18 +00:00
- lint - better error message through check_error when mpv api(s) return with an error - add function hook_add - add function hook_continue - add event handler for MPV_EVENT_HOOK
22 lines
597 B
Python
22 lines
597 B
Python
# makes mpv disable ontop when pausing and re-enable it again when resuming playback
|
|
# please note that this won't do anything if ontop was not enabled before pausing
|
|
|
|
from mpvclient import mpv # type: ignore
|
|
|
|
was_ontop = False
|
|
|
|
|
|
@mpv.observe_property("pause", mpv.MPV_FORMAT_FLAG)
|
|
def func(value):
|
|
ontop = mpv.get_property_node("ontop")
|
|
global was_ontop
|
|
if value:
|
|
if ontop:
|
|
mpv.set_property_node("ontop", False)
|
|
was_ontop = True
|
|
else:
|
|
if was_ontop and not ontop:
|
|
mpv.set_property_node("ontop", True)
|
|
|
|
was_ontop = False
|