diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:36:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:36:56 +0000 |
commit | 51de1d8436100f725f3576aefa24a2bd2057bc28 (patch) | |
tree | c6d1d5264b6d40a8d7ca34129f36b7d61e188af3 /TOOLS/lua/pause-when-minimize.lua | |
parent | Initial commit. (diff) | |
download | mpv-51de1d8436100f725f3576aefa24a2bd2057bc28.tar.xz mpv-51de1d8436100f725f3576aefa24a2bd2057bc28.zip |
Adding upstream version 0.37.0.upstream/0.37.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | TOOLS/lua/pause-when-minimize.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/TOOLS/lua/pause-when-minimize.lua b/TOOLS/lua/pause-when-minimize.lua new file mode 100644 index 0000000..99add70 --- /dev/null +++ b/TOOLS/lua/pause-when-minimize.lua @@ -0,0 +1,20 @@ +-- This script pauses playback when minimizing the window, and resumes playback +-- if it's brought back again. If the player was already paused when minimizing, +-- then try not to mess with the pause state. + +local did_minimize = false + +mp.observe_property("window-minimized", "bool", function(name, value) + local pause = mp.get_property_native("pause") + if value == true then + if pause == false then + mp.set_property_native("pause", true) + did_minimize = true + end + elseif value == false then + if did_minimize and (pause == true) then + mp.set_property_native("pause", false) + end + did_minimize = false + end +end) |