mirror of
https://github.com/mpv-player/mpv
synced 2025-03-22 03:08:33 +00:00
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).
This commit is contained in:
parent
8ef744d1b7
commit
ff25a8c65a
@ -400,6 +400,12 @@ Configurable Options
|
|||||||
Use ``no`` to disable chapter display on hover. Otherwise it's a lua
|
Use ``no`` to disable chapter display on hover. Otherwise it's a lua
|
||||||
``string.format`` template and ``%s`` is replaced with the actual name.
|
``string.format`` template and ``%s`` is replaced with the actual name.
|
||||||
|
|
||||||
|
``unicodeminus``
|
||||||
|
Default: no
|
||||||
|
|
||||||
|
Use a Unicode minus sign instead of an ASCII hyphen when displaying
|
||||||
|
the remaining playback time.
|
||||||
|
|
||||||
|
|
||||||
Script Commands
|
Script Commands
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
@ -53,6 +53,7 @@ local user_opts = {
|
|||||||
chapters_osd = true, -- whether to show chapters OSD on next/prev
|
chapters_osd = true, -- whether to show chapters OSD on next/prev
|
||||||
playlist_osd = true, -- whether to show playlist 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
|
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
|
-- read options from config and command-line
|
||||||
@ -1731,6 +1732,8 @@ function update_options(list)
|
|||||||
request_init()
|
request_init()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local UNICODE_MINUS = string.char(0xe2, 0x88, 0x92) -- UTF-8 for U+2212 MINUS SIGN
|
||||||
|
|
||||||
-- OSC INIT
|
-- OSC INIT
|
||||||
function osc_init()
|
function osc_init()
|
||||||
msg.debug("osc_init")
|
msg.debug("osc_init")
|
||||||
@ -2060,10 +2063,11 @@ function osc_init()
|
|||||||
ne.visible = (mp.get_property_number("duration", 0) > 0)
|
ne.visible = (mp.get_property_number("duration", 0) > 0)
|
||||||
ne.content = function ()
|
ne.content = function ()
|
||||||
if (state.rightTC_trem) then
|
if (state.rightTC_trem) then
|
||||||
|
local minus = user_opts.unicodeminus and UNICODE_MINUS or "-"
|
||||||
if state.tc_ms then
|
if state.tc_ms then
|
||||||
return ("-"..mp.get_property_osd("playtime-remaining/full"))
|
return (minus..mp.get_property_osd("playtime-remaining/full"))
|
||||||
else
|
else
|
||||||
return ("-"..mp.get_property_osd("playtime-remaining"))
|
return (minus..mp.get_property_osd("playtime-remaining"))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if state.tc_ms then
|
if state.tc_ms then
|
||||||
|
Loading…
Reference in New Issue
Block a user