shakukansp
2022-12-12 01:09:41 +08:00
不是 60hz 卡,是低电量 promotion 才会卡
hs.console.clearConsole()
powerSourceCache = hs.battery.powerSource()
enableFreqChange = true
betteryWatcher = hs.battery.watcher.new(function()
powerSource = hs.battery.powerSource()
if (enableFreqChange == false) then
return
end
if (powerSourceCache ~= powerSource)
then
powerSourceCache = powerSource
screen = hs.screen.mainScreen()
currentMode = hs.screen.mainScreen():currentMode()
freq = 120.0
if (powerSource == "AC Power")
then
freq = 120.0
else
freq = 59.0
end
screen:setMode(currentMode["w"], currentMode["h"], currentMode["scale"], freq, currentMode["depth"])
currentMode = hs.screen.mainScreen():currentMode()
hs.alert.show(string.format("%s HZ", currentMode["freq"]))
end
end)
betteryWatcher:start()
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "S", function()
enableFreqChange = not(enableFreqChange)
hs.alert.show(string.format("EditFreq: %s", enableFreqChange))
end)
hammerspoon 的脚本,拿去用吧
低电量切到 59hz ,感觉省电一点
插电切到 promotion