Skip to content

Commit

Permalink
Added a hidden state to the menu (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
shin-ra authored Apr 18, 2024
1 parent 3851f41 commit 59046e9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions subs2srs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ end
-- main menu

menu = Menu:new {
hints_state = switch.new { 'hidden', 'menu', 'global', },
hints_state = switch.new { 'basic', 'menu', 'global', 'hidden', },
}

menu.keybindings = {
Expand All @@ -459,6 +459,9 @@ menu.keybindings = {
}

function menu:print_header(osd)
if self.hints_state.get() == 'hidden' then
return
end
osd:submenu('mpvacious options'):newline()
osd:item('Timings: '):text(h.human_readable_time(subs_observer.get_timing('start')))
osd:item(' to '):text(h.human_readable_time(subs_observer.get_timing('end'))):newline()
Expand All @@ -476,7 +479,7 @@ function menu:print_bindings(osd)
osd:tab():item('ctrl+shift+h: '):text('Replay current subtitle'):newline()
osd:tab():item('shift+h/l: '):text('Seek to the previous/next subtitle'):newline()
osd:tab():item('alt+h/l: '):text('Seek to the previous/next subtitle and pause'):newline()
osd:italics("Press "):item('i'):italics(" to hide bindings."):newline()
osd:italics("Press "):item('i'):italics(" to hide mpvacious options."):newline()
elseif self.hints_state.get() == 'menu' then
osd:submenu('Menu bindings'):newline()
osd:tab():item('c: '):text('Set timings to the current sub'):newline()
Expand All @@ -493,6 +496,8 @@ function menu:print_bindings(osd)
osd:tab():item('p: '):text('Switch to next profile'):newline()
osd:tab():item('ESC: '):text('Close'):newline()
osd:italics("Press "):item('i'):italics(" to show global bindings."):newline()
elseif self.hints_state.get() == 'hidden' then
-- Menu bindings are active but hidden
else
osd:italics("Press "):item('i'):italics(" to show menu bindings."):newline()
end
Expand Down

0 comments on commit 59046e9

Please sign in to comment.