summaryrefslogtreecommitdiffstats
path: root/player/lua
diff options
context:
space:
mode:
authorRyan Hendrickson <ryan.hendrickson@alum.mit.edu>2022-07-07 15:55:43 -0400
committeravih <avih@users.noreply.github.com>2022-07-19 23:19:45 +0300
commitff25a8c65a1c6cf1e38a5e01a3ec47dbe2e65ab7 (patch)
tree156ef4066975a76ccc5c820cc93c537db5c46cf0 /player/lua
parent8ef744d1b7f64b3b7d814ee4d9376d6538befb73 (diff)
downloadmpv-ff25a8c65a1c6cf1e38a5e01a3ec47dbe2e65ab7.tar.bz2
mpv-ff25a8c65a1c6cf1e38a5e01a3ec47dbe2e65ab7.tar.xz
osc.lua: add osc-unicodeminus script option
This option enables the use of the Unicode U+2212 Minus Sign character when displaying the time remaining, instead of "-" (U+002D Hyphen-Minus).
Diffstat (limited to 'player/lua')
-rw-r--r--player/lua/osc.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index bd9f36ec57..7a0da03971 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -53,6 +53,7 @@ local user_opts = {
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
+ unicodeminus = false, -- whether to use the Unicode minus sign character
}
-- read options from config and command-line
@@ -1731,6 +1732,8 @@ function update_options(list)
request_init()
end
+local UNICODE_MINUS = string.char(0xe2, 0x88, 0x92) -- UTF-8 for U+2212 MINUS SIGN
+
-- OSC INIT
function osc_init()
msg.debug("osc_init")
@@ -2060,10 +2063,11 @@ function osc_init()
ne.visible = (mp.get_property_number("duration", 0) > 0)
ne.content = function ()
if (state.rightTC_trem) then
+ local minus = user_opts.unicodeminus and UNICODE_MINUS or "-"
if state.tc_ms then
- return ("-"..mp.get_property_osd("playtime-remaining/full"))
+ return (minus..mp.get_property_osd("playtime-remaining/full"))
else
- return ("-"..mp.get_property_osd("playtime-remaining"))
+ return (minus..mp.get_property_osd("playtime-remaining"))
end
else
if state.tc_ms then