diff --git a/DOCS/man/osc.rst b/DOCS/man/osc.rst index 71af9d2de8..c375c3075d 100644 --- a/DOCS/man/osc.rst +++ b/DOCS/man/osc.rst @@ -382,6 +382,20 @@ Configurable Options Update chapter markers positions on duration changes, e.g. live streams. The updates are unoptimized - consider disabling it on very low-end systems. +``chapters_osd``, ``playlist_osd`` + Default: yes + + Whether to display the chapters/playlist at the OSD when left-clicking the + next/previous OSC buttons, respectively. + +``chapter_fmt`` + Default: ``Chapter: %s`` + + Template for the chapter-name display when hovering the seekbar. + Use ``no`` to disable chapter display on hover. Otherwise it's a lua + ``string.format`` template and ``%s`` is replaced with the actual name. + + Script Commands ~~~~~~~~~~~~~~~ diff --git a/player/lua/osc.lua b/player/lua/osc.lua index 19f4e9b8c4..62f8245995 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -49,6 +49,9 @@ local user_opts = { windowcontrols_alignment = "right", -- which side to show window controls on greenandgrumpy = false, -- disable santa hat livemarkers = true, -- update seekbar chapter markers on duration change + chapters_osd = true, -- whether to show chapters OSD on next/prev + playlist_osd = true, -- whether to show playlist OSD on next/prev + chapter_fmt = "Chapter: %s", -- chapter print format for seekbar-hover. "no" to disable } -- read options from config and command-line @@ -620,13 +623,13 @@ function render_elements(master_ass) -- render iterations because the title may be rendered before the slider. state.forced_title = nil local se, ae = state.slider_element, elements[state.active_element] - if se and (ae == se or (not ae and mouse_hit(se))) then + if user_opts.chapter_fmt ~= "no" and se and (ae == se or (not ae and mouse_hit(se))) then local dur = mp.get_property_number("duration", 0) if dur > 0 then local possec = get_slider_value(se) * dur / 100 -- of mouse pos local ch = get_chapter(possec) if ch and ch.title and ch.title ~= "" then - state.forced_title = "Chapter: " .. ch.title + state.forced_title = string.format(user_opts.chapter_fmt, ch.title) end end end @@ -1806,7 +1809,9 @@ function osc_init() ne.eventresponder["mbtn_left_up"] = function () mp.commandv("playlist-prev", "weak") - show_message(get_playlist(), 3) + if user_opts.playlist_osd then + show_message(get_playlist(), 3) + end end ne.eventresponder["shift+mbtn_left_up"] = function () show_message(get_playlist(), 3) end @@ -1821,7 +1826,9 @@ function osc_init() ne.eventresponder["mbtn_left_up"] = function () mp.commandv("playlist-next", "weak") - show_message(get_playlist(), 3) + if user_opts.playlist_osd then + show_message(get_playlist(), 3) + end end ne.eventresponder["shift+mbtn_left_up"] = function () show_message(get_playlist(), 3) end @@ -1876,7 +1883,9 @@ function osc_init() ne.eventresponder["mbtn_left_up"] = function () mp.commandv("add", "chapter", -1) - show_message(get_chapterlist(), 3) + if user_opts.chapters_osd then + show_message(get_chapterlist(), 3) + end end ne.eventresponder["shift+mbtn_left_up"] = function () show_message(get_chapterlist(), 3) end @@ -1891,7 +1900,9 @@ function osc_init() ne.eventresponder["mbtn_left_up"] = function () mp.commandv("add", "chapter", 1) - show_message(get_chapterlist(), 3) + if user_opts.chapters_osd then + show_message(get_chapterlist(), 3) + end end ne.eventresponder["shift+mbtn_left_up"] = function () show_message(get_chapterlist(), 3) end