summaryrefslogtreecommitdiff
path: root/osd.lua
diff options
context:
space:
mode:
Diffstat (limited to 'osd.lua')
-rw-r--r--osd.lua19
1 files changed, 18 insertions, 1 deletions
diff --git a/osd.lua b/osd.lua
index 451f2a9..31cc49c 100644
--- a/osd.lua
+++ b/osd.lua
@@ -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()