From 791068d255f8444d9b144a3f7cc9259075fbb2fd Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 17 Mar 2014 18:27:44 +0100 Subject: osc: add enable/disable message, and map DEL to disabling the OSC "enable-osc" will make the OSC appear at any time (although it'll quickly disappear again if the mouse is not inside the OSC). "disable- osc" will make it disappear permanently. Also, if the OSC is visible, force remap the DEL key to make the OSC disappear. --- player/lua/osc.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/player/lua/osc.lua b/player/lua/osc.lua index 4f217d33c5..9a575f657a 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -1257,10 +1257,23 @@ function tick() end end +function enable_osc(enable) + if enable then + mp.enable_key_bindings("showhide") + show_osc() + else + hide_osc() + mp.disable_key_bindings("showhide") + end +end + mp.register_event("tick", tick) mp.register_event("start-file", request_init) mp.register_event("tracks-changed", request_init) +mp.register_script_message("enable-osc", function() enable_osc(true) end) +mp.register_script_message("disable-osc", function() enable_osc(false) end) + -- mouse show/hide bindings mp.set_key_bindings({ {"mouse_move", function(e) process_event("mouse_move", nil) end}, @@ -1279,5 +1292,6 @@ mp.set_key_bindings({ {"mouse_btn0_dbl", "ignore"}, {"shift+mouse_btn0_dbl", "ignore"}, {"mouse_btn2_dbl", "ignore"}, + {"del", function() enable_osc(false) end} }, "input", "force") mp.enable_key_bindings("input") -- cgit v1.2.3