diff options
author | Ricardo Constantino <wiiaboo@gmail.com> | 2016-12-01 21:59:27 +0000 |
---|---|---|
committer | Ricardo Constantino <wiiaboo@gmail.com> | 2016-12-02 16:59:40 +0000 |
commit | 796b48b2a32219cfd82a8eab11bb5996dcbc40ca (patch) | |
tree | 6724c8413b4052a3d60d2ec9ad87ab0aee4a4290 /player/lua/osc.lua | |
parent | a7a919f93f966f5ba5b4c5a9117ad136b8447d4d (diff) | |
download | mpv-796b48b2a32219cfd82a8eab11bb5996dcbc40ca.tar.bz2 mpv-796b48b2a32219cfd82a8eab11bb5996dcbc40ca.tar.xz |
osc: don't hide playlist buttons, just disable
Having empty space before the title in layout=*bar looks worse
than the floating buttons in layout=box.
Also disable both playlist buttons selectively according to the
current position.
Diffstat (limited to 'player/lua/osc.lua')
-rw-r--r-- | player/lua/osc.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua index fffbbc5e9b..63d0740c6a 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -1502,8 +1502,9 @@ function osc_init() elements = {} -- some often needed stuff - local pl_count = mp.get_property_number("playlist-count") + local pl_count = mp.get_property_number("playlist-count", 0) local have_pl = (pl_count > 1) + local pl_pos = mp.get_property_number("playlist-pos", 0) + 1 local have_ch = (mp.get_property_number("chapters", 0) > 0) local ne @@ -1523,8 +1524,8 @@ function osc_init() ne.eventresponder["mouse_btn0_up"] = function () local title = mp.get_property_osd("media-title") if (have_pl) then - local pl_pos = countone(mp.get_property_number("playlist-pos")) - title = "[" .. pl_pos .. "/" .. pl_count .. "] " .. title + title = string.format("[%d/%d] %s", countone(pl_pos - 1), + pl_count, title) end show_message(title) end @@ -1538,7 +1539,7 @@ function osc_init() ne = new_element("pl_prev", "button") ne.content = "\238\132\144" - ne.visible = have_pl + ne.enabled = (pl_pos > 1) ne.eventresponder["mouse_btn0_up"] = function () mp.commandv("playlist-prev", "weak") @@ -1553,7 +1554,7 @@ function osc_init() ne = new_element("pl_next", "button") ne.content = "\238\132\129" - ne.visible = have_pl + ne.enabled = (have_pl) and (pl_pos < pl_count) ne.eventresponder["mouse_btn0_up"] = function () mp.commandv("playlist-next", "weak") |