[download]

config/mpv/scripts/osc-toggle.lua

   1 local visibility = true
   2 mp.add_key_binding(nil, "osc-toggle", function()
   3     visibility = not visibility
   4     mp.commandv("script-message", "osc-visibility", visibility and "auto" or "always")
   5 end)