|
|
@ -32,13 +32,13 @@ function obj:start()
|
|
|
|
self:reset()
|
|
|
|
self:reset()
|
|
|
|
|
|
|
|
|
|
|
|
-- Reset if we're waking from sleep
|
|
|
|
-- Reset if we're waking from sleep
|
|
|
|
hs.caffeinate.watcher.new(function(event)
|
|
|
|
self.watcher = hs.caffeinate.watcher.new(function(event)
|
|
|
|
if event ~= hs.caffeinate.watcher.systemDidWake then return end
|
|
|
|
if event ~= hs.caffeinate.watcher.systemDidWake then return end
|
|
|
|
self:reset()
|
|
|
|
self:reset()
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
-- Set last focused time for relevant apps
|
|
|
|
-- Set last focused time for relevant apps
|
|
|
|
hs.window.filter.default:subscribe(hs.window.filter.windowFocused, function(window, appName)
|
|
|
|
self.windowFilter = hs.window.filter.default:subscribe(hs.window.filter.windowFocused, function(window, appName)
|
|
|
|
local bundleID = window:application():bundleID()
|
|
|
|
local bundleID = window:application():bundleID()
|
|
|
|
if not self.quitAppsAfter[bundleID] then return end
|
|
|
|
if not self.quitAppsAfter[bundleID] then return end
|
|
|
|
self.lastFocused[bundleID] = os.time()
|
|
|
|
self.lastFocused[bundleID] = os.time()
|
|
|
@ -51,6 +51,18 @@ function obj:start()
|
|
|
|
return self
|
|
|
|
return self
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--- Quitter:stop()
|
|
|
|
|
|
|
|
--- Method
|
|
|
|
|
|
|
|
--- Stop Quitter
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
--- Parameters:
|
|
|
|
|
|
|
|
--- * None
|
|
|
|
|
|
|
|
function obj:stop()
|
|
|
|
|
|
|
|
self.watcher:stop()
|
|
|
|
|
|
|
|
self.windowFilter:unsubscribe()
|
|
|
|
|
|
|
|
self.timer:stop()
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function obj:reset()
|
|
|
|
function obj:reset()
|
|
|
|
hs.fnutils.ieach(hs.application.runningApplications(), function(app)
|
|
|
|
hs.fnutils.ieach(hs.application.runningApplications(), function(app)
|
|
|
|
local bundleID = app:bundleID()
|
|
|
|
local bundleID = app:bundleID()
|
|
|
|