summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2022-05-24 18:16:28 -0500
committerDudemanguy <random342@airmail.cc>2022-06-04 14:48:32 +0000
commitec236f7a99754adb95fada8195f25c03c2218545 (patch)
tree40cc2e999b1e2b9df39c5a9781942716436afc33 /player
parent5c4b0c2afd4b1482d51965ad680c4676116b4bf2 (diff)
downloadmpv-ec236f7a99754adb95fada8195f25c03c2218545.tar.bz2
mpv-ec236f7a99754adb95fada8195f25c03c2218545.tar.xz
osc.lua: add idlescreen and osc-idlescreen
This is mainly for other user scripts that may conflict with the osc logo in some way. Although it is possible to listen for shared-script-properties, this has many edge cases that could easily pop up. A user could want other OSC things to happen at the same time (say osc-message). They just don't want the logo. The idlescreen option disables all idlescreen related things (including the santa hat) if it is set to "no". A new script message (osc-idlescreen) is also added so users can easily toggle the value (passing "cycle" or just explictly setting "yes" or "no"). Some more discussion on this is found in the below github issues. https://github.com/mpv-player/mpv/issues/10201 https://github.com/CogentRedTester/mpv-file-browser/issues/55
Diffstat (limited to 'player')
-rw-r--r--player/lua/osc.lua47
1 files changed, 39 insertions, 8 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index e1d6188814..bd9f36ec57 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -11,6 +11,7 @@ local utils = require 'mp.utils'
local user_opts = {
showwindowed = true, -- show OSC when windowed?
showfullscreen = true, -- show OSC when fullscreen?
+ idlescreen = true, -- show mpv logo on idle
scalewindowed = 1, -- scaling of the controller when windowed
scalefullscreen = 1, -- scaling of the controller when fullscreen
scaleforcedwindow = 2, -- scaling when rendered on a forced window
@@ -2579,23 +2580,27 @@ function tick()
local ass = assdraw.ass_new()
-- mpv logo
- for i, line in ipairs(logo_lines) do
- ass:new_event()
- ass:append(line_prefix .. line)
+ if user_opts.idlescreen then
+ for i, line in ipairs(logo_lines) do
+ ass:new_event()
+ ass:append(line_prefix .. line)
+ end
end
-- Santa hat
- if is_december and not user_opts.greenandgrumpy then
+ if is_december and user_opts.idlescreen and not user_opts.greenandgrumpy then
for i, line in ipairs(santa_hat_lines) do
ass:new_event()
ass:append(line_prefix .. line)
end
end
- ass:new_event()
- ass:pos(320, icon_y+65)
- ass:an(8)
- ass:append("Drop files or URLs to play here.")
+ if user_opts.idlescreen then
+ ass:new_event()
+ ass:pos(320, icon_y+65)
+ ass:an(8)
+ ass:append("Drop files or URLs to play here.")
+ end
set_osd(640, 360, ass.text)
if state.showhide_enabled then
@@ -2844,9 +2849,35 @@ function visibility_mode(mode, no_osd)
request_tick()
end
+function idlescreen_visibility(mode, no_osd)
+ if mode == "cycle" then
+ if user_opts.idlescreen then
+ mode = "no"
+ else
+ mode = "yes"
+ end
+ end
+
+ if mode == "yes" then
+ user_opts.idlescreen = true
+ else
+ user_opts.idlescreen = false
+ end
+
+ utils.shared_script_property_set("osc-idlescreen", mode)
+
+ if not no_osd and tonumber(mp.get_property("osd-level")) >= 1 then
+ mp.osd_message("OSC logo visibility: " .. tostring(mode))
+ end
+
+ request_tick()
+end
+
visibility_mode(user_opts.visibility, true)
mp.register_script_message("osc-visibility", visibility_mode)
mp.add_key_binding(nil, "visibility", function() visibility_mode("cycle") end)
+mp.register_script_message("osc-idlescreen", idlescreen_visibility)
+
set_virt_mouse_area(0, 0, 0, 0, "input")
set_virt_mouse_area(0, 0, 0, 0, "window-controls")