From ebf61267f4349e28fa97c0c14c66631cbf24efba Mon Sep 17 00:00:00 2001 From: Ricardo Constantino Date: Mon, 27 Mar 2017 17:40:48 +0100 Subject: Revert "osc: make the title toggleable between media-title and filename" This reverts commit 6573b73462e336da0daca845ba4df02782afc2b6. --- DOCS/man/osc.rst | 10 ++-------- player/lua/osc.lua | 21 ++++++++++----------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/DOCS/man/osc.rst b/DOCS/man/osc.rst index 7d9a86101c..ecb4d99244 100644 --- a/DOCS/man/osc.rst +++ b/DOCS/man/osc.rst @@ -46,8 +46,8 @@ title | Displays current media-title or filename ============= ================================================ - left-click toggle displaying media-title or filename - right-click show playlist position and length and filename + left-click show playlist position and length and full title + right-click show filename ============= ================================================ cache @@ -239,12 +239,6 @@ Configurable Options Duration of fade out in ms, 0 = no fade -``prefertitle`` - Default: yes - - Display media title if available (yes) or always display the - filename (no). - ``tooltipborder`` Default: 1 diff --git a/player/lua/osc.lua b/player/lua/osc.lua index 6f1fa4eea7..8997ae4ac6 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -34,7 +34,6 @@ local user_opts = { layout = "bottombar", seekbarstyle = "bar", -- slider (diamond marker), knob (circle -- marker with guide), or bar (fill) - prefertitle = true, -- show media-title (true) or filename (false) tooltipborder = 1, -- border of tooltip in bottom/topbar timetotal = false, -- display total time instead of remaining time? timems = false, -- display timecodes with milliseconds? @@ -102,7 +101,6 @@ local state = { enabled = true, input_enabled = true, showhide_enabled = false, - prefertitle = user_opts.prefertitle } @@ -1513,18 +1511,16 @@ function osc_init() ne = new_element("title", "button") ne.content = function () - return (state.prefertitle) and - mp.get_property_osd("media-title", "mpv") or - mp.get_property_osd("filename", "mpv") + local title = mp.get_property_osd("media-title") + if not (title == nil) then + return (title) + else + return ("mpv") + end end ne.eventresponder["mouse_btn0_up"] = function () - state.prefertitle = not state.prefertitle - request_init() - end - - ne.eventresponder["mouse_btn2_up"] = function () - local title = mp.get_property_osd("filename") + local title = mp.get_property_osd("media-title") if (have_pl) then title = string.format("[%d/%d] %s", countone(pl_pos - 1), pl_count, title) @@ -1532,6 +1528,9 @@ function osc_init() show_message(title) end + ne.eventresponder["mouse_btn2_up"] = + function () show_message(mp.get_property_osd("filename")) end + -- playlist buttons -- prev -- cgit v1.2.3