Skip to content

Instantly share code, notes, and snippets.

@selsta
Last active October 7, 2018 13:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save selsta/9ac023688885053d42ca to your computer and use it in GitHub Desktop.
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)
-- 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