Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cycling through OSC visibility mode #7

Merged
merged 2 commits into from
Feb 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions mordenx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2199,6 +2199,16 @@ end
-- mode can be auto/always/never/cycle
-- the modes only affect internal variables and not stored on its own.
function visibility_mode(mode, no_osd)
if mode == "cycle" then
if not state.enabled then
mode = "auto"
elseif user_opts.visibility ~= "always" then
mode = "always"
else
mode = "never"
end
end

if mode == 'auto' then
always_on(false)
enable_osc(true)
Expand All @@ -2211,9 +2221,10 @@ function visibility_mode(mode, no_osd)
msg.warn('Ignoring unknown visibility mode \"' .. mode .. '\"')
return
end

user_opts.visibility = mode

utils.shared_script_property_set("osc-visibility", mode)

if not no_osd and tonumber(mp.get_property('osd-level')) >= 1 then
mp.osd_message('OSC visibility: ' .. mode)
end
Expand Down