Last active
October 7, 2018 13:12
-
-
Save selsta/9ac023688885053d42ca to your computer and use it in GitHub Desktop.
Choose the VO based on if the laptop is plugged in or not. (OS X)
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
-- If the laptop is on battery, the VO set in the config will be choosen, | |
-- else the one defined with „hqvo“ is used. | |
local hqvo = "opengl-hq:gamma-auto" | |
local utils = require 'mp.utils' | |
if mp.get_property_bool("option-info/vo/set-from-commandline") == true then | |
return | |
end | |
t = {} | |
t.args = {"/usr/bin/pmset", "-g", "ac"} | |
res = utils.subprocess(t) | |
if res.stdout ~= "No adapter attached.\n" then | |
mp.set_property("options/vo", hqvo) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment