解决唤醒后夜览失效和蓝牙占用CPU问题
解决方式是登录后开关一次,夜览和蓝牙原理一样1. 终端先安装软件
-- brew install hammerspoon-- brew install smudge/smudge/nightlight-- brew install blueutil
2. 脚本内容
默认位置在 ~/.hammerspoon/init.lua
function nightlightControl(state) print('nightlightControl ', state) cmd = "/usr/local/bin/nightlight " .. (state) ok, result = hs.osascript.applescript(string.format('do shell script "%s"', cmd)) return resultendfunction bluetoothControl(state) cmd = "blueutil -p " .. (state) ok, result = hs.osascript.applescript(string.format('do shell script "%s"', cmd)) return resultendfunction caffeinateCallback(eventType) if (eventType == hs.caffeinate.watcher.screensDidSleep) then bluetoothControl("0") elseif (eventType == hs.caffeinate.watcher.screensDidWake) then bluetoothControl("1") elseif (eventType == hs.caffeinate.watcher.screensDidUnlock) then if (string.match(nightlightControl('status'), 'on')) then nightlightControl('off') nightlightControl('on') end endendcaffeinateWatcher = hs.caffeinate.watcher.new(caffeinateCallback)caffeinateWatcher:start()OR 试试看和另一个脚本有啥区别,另一个脚本有时候只关闭但不重新打开 我是来抢楼的 :lol20年水粉 我是来抢楼的 黑哥的论坛,要支持 水窝老用户,支持下 23年水窝,感谢有你 不错,支持下楼主 我喜欢黑妹,可以约起来吗
页:
[1]
2