summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Constantino <wiiaboo@gmail.com>2017-03-27 17:44:24 +0100
committerRicardo Constantino <wiiaboo@gmail.com>2017-03-27 18:00:56 +0100
commitdc00ad537f74dc6010afdc5c4f03a32a8bf2793a (patch)
tree1ae7c06df6d81fa3eb0969d05b4a977f9da06c1c
parentebf61267f4349e28fa97c0c14c66631cbf24efba (diff)
downloadmpv-dc00ad537f74dc6010afdc5c4f03a32a8bf2793a.tar.bz2
mpv-dc00ad537f74dc6010afdc5c4f03a32a8bf2793a.tar.xz
osc: make title configurable and use property expansion on it
-rw-r--r--DOCS/man/osc.rst8
-rw-r--r--player/lua/osc.lua10
2 files changed, 11 insertions, 7 deletions
diff --git a/DOCS/man/osc.rst b/DOCS/man/osc.rst
index ecb4d99244..17911bbf68 100644
--- a/DOCS/man/osc.rst
+++ b/DOCS/man/osc.rst
@@ -43,7 +43,7 @@ pl next
============= ================================================
title
- | Displays current media-title or filename
+ | Displays current media-title, filename, or custom title
============= ================================================
left-click show playlist position and length and full title
@@ -239,6 +239,12 @@ Configurable Options
Duration of fade out in ms, 0 = no fade
+``title``
+ Default: ${media-title}
+
+ String that supports property expansion that will be displayed as
+ OSC title.
+
``tooltipborder``
Default: 1
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index 8997ae4ac6..569bb208ac 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -34,6 +34,8 @@ local user_opts = {
layout = "bottombar",
seekbarstyle = "bar", -- slider (diamond marker), knob (circle
-- marker with guide), or bar (fill)
+ title = "${media-title}", -- string compatible with property-expansion
+ -- to be shown as OSC title
tooltipborder = 1, -- border of tooltip in bottom/topbar
timetotal = false, -- display total time instead of remaining time?
timems = false, -- display timecodes with milliseconds?
@@ -1511,12 +1513,8 @@ 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
+ local title = mp.command_native({"expand-text", user_opts.title})
+ return not (title == "") and title or "mpv"
end
ne.eventresponder["mouse_btn0_up"] = function ()