Script for stop and start better display

Anonymous
Lua
02/19/2023 11:13 AM
617 B
75
Indexable
Never
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...