| @@ -44,6 +44,7 @@ local user_opts = { · 43 unmodified lines |
| 44 | 44 | timems = false, -- display timecodes with milliseconds? |
| 45 | 45 | tcspace = 100, -- timecode spacing (compensate font size estimation) |
| 46 | 46 | visibility = "auto", -- only used at init to set visibility_mode(...) |
| 47 | + visibility_modes = "never_auto_always", -- visibility modes to cycle through |
| 47 | 48 | boxmaxchars = 80, -- title crop threshold for box layout |
| 48 | 49 | boxvideo = false, -- apply osc_param.video_margins to video |
| 49 | 50 | windowcontrols = "auto", -- whether to show window controls |
| @@ -255,6 +256,7 @@ local state = { · 205 unmodified lines |
| 255 | 256 | maximized = false, |
| 256 | 257 | osd = mp.create_osd_overlay("ass-events"), |
| 257 | 258 | chapter_list = {}, -- sorted by time |
| 259 | + visibility_modes = {}, -- visibility_modes to cycle through |
| 258 | 260 | osc_message_warned = false, -- deprecation warnings |
| 259 | 261 | osc_chapterlist_warned = false, |
| 260 | 262 | osc_playlist_warned = false, |
| @@ -2774,12 +2776,14 @@ end · 2513 unmodified lines |
| 2774 | 2776 | -- the modes only affect internal variables and not stored on its own. |
| 2775 | 2777 | local function visibility_mode(mode, no_osd) |
| 2776 | 2778 | if mode == "cycle" then |
| 2777 | | − if not state.enabled then |
| 2778 | | − mode = "auto" |
| 2779 | | − elseif user_opts.visibility ~= "always" then |
| 2780 | | − mode = "always" |
| 2781 | | − else |
| 2782 | | − mode = "never" |
| 2779 | + for i, allowed_mode in ipairs(state.visibility_modes) do |
| 2780 | + if i == #state.visibility_modes then |
| 2781 | + mode = state.visibility_modes[1] |
| 2782 | + break |
| 2783 | + elseif user_opts.visibility == allowed_mode then |
| 2784 | + mode = state.visibility_modes[i + 1] |
| 2785 | + break |
| 2786 | + end |
| 2783 | 2787 | end |
| 2784 | 2788 | end |
| 2785 | 2789 | |
| @@ -2907,6 +2911,14 @@ local function validate_user_opts() · 121 unmodified lines |
| 2907 | 2911 | msg.warn("'" .. color .. "' is not a valid color") |
| 2908 | 2912 | end |
| 2909 | 2913 | end |
| 2914 | + |
| 2915 | + for str in string.gmatch(user_opts.visibility_modes, "([^_]+)") do |
| 2916 | + if str ~= "auto" and str ~= "always" and str ~= "never" then |
| 2917 | + msg.warn("Ignoring unknown visibility mode '" .. str .."' in list") |
| 2918 | + else |
| 2919 | + table.insert(state.visibility_modes, str) |
| 2920 | + end |
| 2921 | + end |
| 2910 | 2922 | end |
| 2911 | 2923 | |
| 2912 | 2924 | -- read options from config and command-line |