aboutsummaryrefslogtreecommitdiffhomepage
path: root/player
diff options
context:
space:
mode:
authorGravatar Ricardo Constantino <wiiaboo@gmail.com>2017-03-26 13:57:17 +0100
committerGravatar Ricardo Constantino <wiiaboo@gmail.com>2017-03-26 14:41:03 +0100
commit6573b73462e336da0daca845ba4df02782afc2b6 (patch)
tree81cbe9c9b07db9365bc6b4cd60ec1720be2ef492 /player
parent3eb6607e5e3137e7801c669952f715b626f7afb0 (diff)
osc: make the title toggleable between media-title and filename
Close #4221
Diffstat (limited to 'player')
-rw-r--r--player/lua/osc.lua21
1 files changed, 11 insertions, 10 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index 8997ae4ac6..6f1fa4eea7 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -34,6 +34,7 @@ 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?
@@ -101,6 +102,7 @@ local state = {
enabled = true,
input_enabled = true,
showhide_enabled = false,
+ prefertitle = user_opts.prefertitle
}
@@ -1511,16 +1513,18 @@ function osc_init()
ne = new_element("title", "button")
ne.content = function ()
- local title = mp.get_property_osd("media-title")
- if not (title == nil) then
- return (title)
- else
- return ("mpv")
- end
+ return (state.prefertitle) and
+ mp.get_property_osd("media-title", "mpv") or
+ mp.get_property_osd("filename", "mpv")
end
ne.eventresponder["mouse_btn0_up"] = function ()
- local title = mp.get_property_osd("media-title")
+ state.prefertitle = not state.prefertitle
+ request_init()
+ end
+
+ ne.eventresponder["mouse_btn2_up"] = function ()
+ local title = mp.get_property_osd("filename")
if (have_pl) then
title = string.format("[%d/%d] %s", countone(pl_pos - 1),
pl_count, title)
@@ -1528,9 +1532,6 @@ function osc_init()
show_message(title)
end
- ne.eventresponder["mouse_btn2_up"] =
- function () show_message(mp.get_property_osd("filename")) end
-
-- playlist buttons
-- prev