Created
April 20, 2024 19:13
-
-
Save oficsu/7a922f252ae8162292929f755a419a60 to your computer and use it in GitHub Desktop.
A script implementing picture-in-picture feature for mpv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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