local mp = require("mp") local utils = require("mp.utils") local run = function(...) utils.subprocess_detached({ args = { "sh", "-c", table.concat({ ... }, " ") .. " >/dev/null 2>&1" }, max_size = 0, cancellable = false, }) end local has_video = function() local v = mp.get_property("video") return v and v ~= "no" and v ~= "" end mp.register_event("start-file", function() run("makoctl", "mode", "-a", "off") if has_video() then run("svdn", "wlsunset") end end) mp.register_event("shutdown", function() run("makoctl", "mode", "-r", "off") if has_video() then run("svup", "wlsunset") end end)