Skip to content

Instantly share code, notes, and snippets.

@oficsu
Created April 20, 2024 19:13
Show Gist options
  • Save oficsu/7a922f252ae8162292929f755a419a60 to your computer and use it in GitHub Desktop.
Save oficsu/7a922f252ae8162292929f755a419a60 to your computer and use it in GitHub Desktop.
A script implementing picture-in-picture feature for mpv
local msg = require 'mp.msg'
local options = require 'mp.options'
local opts = {
enabled = true,
active = false,
}
options.read_options(opts)
function enable()
if not opts.enabled then return end
opts.active = true
mp.set_property("border", "no")
mp.set_property("ontop", "yes")
end
function disable()
if not opts.enabled then return end
opts.active = false
mp.set_property("border", "yes")
mp.set_property("ontop", "no")
end
function toggle()
if opts.active then
disable()
else
enable()
end
end
if opts.enabled and opts.active then
enable()
end
mp.add_key_binding(nil, "toggle", toggle)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment