summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-01-10 21:55:15 -0800
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-01-10 21:55:15 -0800
commit206f73ed62003dba5041348f17433b1b3fe70174 (patch)
tree252b94a0614a881d4fca6c28e961699310b622a7
parent692ed98334ed9c993c6da7c95b80fe2233707578 (diff)
downloadmpv-iptv-menu-206f73ed62003dba5041348f17433b1b3fe70174.tar.gz
mpv-iptv-menu-206f73ed62003dba5041348f17433b1b3fe70174.tar.xz
disable OSC while menu is active
-rw-r--r--main.lua22
1 files changed, 20 insertions, 2 deletions
diff --git a/main.lua b/main.lua
index 215fbf4..4cc58ea 100644
--- a/main.lua
+++ b/main.lua
@@ -58,6 +58,7 @@ local osd = _osd.new({
})
local key_bindings = {}
+local osc_visibility
local function update_osd()
osd:redraw(state)
@@ -1030,11 +1031,27 @@ local function set_key_bindings()
end
end
+local function set_osc_visibility()
+ local v = osd:is_hidden() and osc_visibility or 'never'
+ mp.command_native({'script-message', 'osc-visibility', v, ''})
+end
+
local function toggle_menu()
osd:toggle_hidden()
+
+ if osc_visibility ~= 'never' then
+ set_osc_visibility()
+ end
+
set_key_bindings()
end
+mp.observe_property('user-data/osc/visibility', 'native', function(_, val)
+ if osd:is_hidden() or val ~= 'never' then
+ osc_visibility = val
+ end
+end)
+
mp.observe_property('osd-dimensions', 'native', function(_, val)
osd:resize(val.w, val.h)
update_osd()
@@ -1050,11 +1067,12 @@ mp.register_event('end-file', function()
update_osd()
end)
-mp.command_native({'script-message', 'osc-idlescreen', 'no', ''})
-
load_data()
push_group_menu(catalogue:get('root'))
+osc_visibility = mp.get_property('user-data/osc/visibility', 'auto')
+set_osc_visibility()
+
-- keys added via bind_key() are unbound when the OSD is closed, but we want
-- toggle-menu to work regardless of setting.
mp.add_forced_key_binding('TAB', 'toggle-menu', toggle_menu)