From ff25a8c65a1c6cf1e38a5e01a3ec47dbe2e65ab7 Mon Sep 17 00:00:00 2001 From: Ryan Hendrickson Date: Thu, 7 Jul 2022 15:55:43 -0400 Subject: 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). --- player/lua/osc.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'player/lua') 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 -- cgit v1.2.3