diff options
| author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2026-01-14 00:27:08 -0800 |
|---|---|---|
| committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2026-01-14 00:27:08 -0800 |
| commit | 671e5934a9400b722210d4d243dd83c0755a4fa3 (patch) | |
| tree | bd267d3b3b89a670dd6eea9620dd75accb411830 /osd.lua | |
| parent | 16911601f7da38191c5c1fe900d615f8b860ca52 (diff) | |
| download | mpv-iptv-menu-671e5934a9400b722210d4d243dd83c0755a4fa3.tar.gz mpv-iptv-menu-671e5934a9400b722210d4d243dd83c0755a4fa3.tar.xz | |
add status line; load data after mpv opens
Diffstat (limited to 'osd.lua')
| -rw-r--r-- | osd.lua | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -60,6 +60,21 @@ function mt:resize(w, h) self.scale = h / 720 end +function mt:set_status(msg, level) + self.status_msg = msg + self.status_level = level +end + +function mt:status_line() + if not self.status_msg then + return '' + end + + local col = self.status_level == 'error' and colours.status_error or + colours.status_info + return col .. '🞸 {\\i1}' .. asscape(self.status_msg) +end + function mt:menu_lines(state) -- leaves an extra line for padding between titles and options return self.lines - state.depth - 1 @@ -363,7 +378,9 @@ function mt:redraw(state) for i = 1, state.depth do out[#out+1] = self:menu_title(state.menus[i]) end - out[#out+1] = '' + + -- use spacer line between titles and options for status messages + out[#out+1] = self:status_line() local menu = state:menu() |
