dfdfdf
This commit is contained in:
@@ -4,6 +4,31 @@ local msg = require 'mp.msg'
|
||||
|
||||
local M = {}
|
||||
|
||||
-- Lyrics overlay toggle
|
||||
-- The Python helper (python -m MPV.lyric) will read this property via IPC.
|
||||
local LYRIC_VISIBLE_PROP = "user-data/medeia-lyric-visible"
|
||||
|
||||
local function lyric_get_visible()
|
||||
local ok, v = pcall(mp.get_property_native, LYRIC_VISIBLE_PROP)
|
||||
if not ok or v == nil then
|
||||
return true
|
||||
end
|
||||
return v and true or false
|
||||
end
|
||||
|
||||
local function lyric_set_visible(v)
|
||||
pcall(mp.set_property_native, LYRIC_VISIBLE_PROP, v and true or false)
|
||||
end
|
||||
|
||||
local function lyric_toggle()
|
||||
local now = not lyric_get_visible()
|
||||
lyric_set_visible(now)
|
||||
mp.osd_message("Lyrics: " .. (now and "on" or "off"), 1)
|
||||
end
|
||||
|
||||
-- Default to visible unless user overrides.
|
||||
lyric_set_visible(true)
|
||||
|
||||
-- Configuration
|
||||
local opts = {
|
||||
python_path = "python",
|
||||
@@ -138,4 +163,8 @@ mp.add_key_binding("mbtn_right", "medios-menu-right-click", M.show_menu)
|
||||
mp.add_key_binding("ctrl+i", "medios-info", M.get_file_info)
|
||||
mp.add_key_binding("ctrl+del", "medios-delete", M.delete_current_file)
|
||||
|
||||
-- Lyrics toggle (requested: 'L')
|
||||
mp.add_key_binding("l", "medeia-lyric-toggle", lyric_toggle)
|
||||
mp.add_key_binding("L", "medeia-lyric-toggle-shift", lyric_toggle)
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user