Untitled

 avatar
unknown
plain_text
2 years ago
617 B
4
Indexable
appWatcher = hs.caffeinate.watcher.new(function(eventType)
    -- screensDidWake, systemDidWake, screensDidUnlock
    if eventType == hs.caffeinate.watcher.systemWillSleep then
        print('WillSleep:')
        app = hs.application.get("BetterDisplay")

        if app then
            print('  Kill')
            app:kill()
        end

    elseif eventType == hs.caffeinate.watcher.systemDidWake then
        print('systemDidWake:')
        --hs.application.open("BetterDisplay")
        Atimer = hs.timer.doAfter(2, function()  hs.application.open("BetterDisplay")return true end)
    end
end)
appWatcher:start()
Editor is loading...