[hammerspoon] quitter tweaks

- Don't kill Discord for now (for Advent of Code!)
- Kill apps on unfocused time, not on last focused time
pull/37/head
Alpha Chen 3 years ago
parent 898b76523e
commit 68ebf7c9ce

@ -12,7 +12,7 @@ obj.version = "0.1"
obj.author = "Alpha Chen <alpha@kejadlen.dev>" obj.author = "Alpha Chen <alpha@kejadlen.dev>"
obj.license = "MIT - https://opensource.org/licenses/MIT" obj.license = "MIT - https://opensource.org/licenses/MIT"
obj.logger = hs.logger.new("quitter") obj.logger = hs.logger.new("quitter", "debug")
obj.lastFocused = {} obj.lastFocused = {}
--- Quitter.quitAppsAfter --- Quitter.quitAppsAfter
@ -40,9 +40,9 @@ function obj:start()
for app, _ in pairs(self.quitAppsAfter) do for app, _ in pairs(self.quitAppsAfter) do
self.windowFilter:allowApp(app) self.windowFilter:allowApp(app)
end end
self.windowFilter:subscribe(hs.window.filter.windowFocused, function(window, appName) self.windowFilter:subscribe(hs.window.filter.windowUnfocused, function(window, appName)
local name = window:application():name() local name = window:application():name()
obj.lastFocused[name] = os.time() self.lastFocused[name] = os.time()
end) end)
self.timer = hs.timer.doEvery(60, function() self.timer = hs.timer.doEvery(60, function()

@ -2,6 +2,7 @@
(set hs.window.animationDuration 0.0) (set hs.window.animationDuration 0.0)
(hs.loadSpoon "MiroWindowsManager") (hs.loadSpoon "MiroWindowsManager")
(set spoon.MiroWindowsManager.fullScreenSizes [1]) ;; only fullscreen
(let [mash [:cmd :alt :ctrl] (let [mash [:cmd :alt :ctrl]
smash [:cmd :alt :ctrl :shift]] smash [:cmd :alt :ctrl :shift]]
(spoon.MiroWindowsManager:bindHotkeys { (spoon.MiroWindowsManager:bindHotkeys {
@ -10,9 +11,9 @@
:down [ mash "j" ] :down [ mash "j" ]
:right [ mash "l" ] :right [ mash "l" ]
:fullscreen [ mash "m" ] :fullscreen [ mash "m" ]
:center [ mash "c" ] ;; :center [ mash "c" ]
:move [ smash "m" ] ;; :move [ smash "m" ]
:resize [ mash "d" ] ;; :resize [ mash "d" ]
})) }))
(let [mash [:cmd :alt :ctrl] (let [mash [:cmd :alt :ctrl]
@ -42,11 +43,12 @@
(hs.loadSpoon "Quitter") (hs.loadSpoon "Quitter")
(set spoon.Quitter.quitAppsAfter { (set spoon.Quitter.quitAppsAfter {
:Discord 300 ;; :Discord 300
:Flotato 300 :Flotato 300
:MailMate 300 :MailMate 300
:Messages 300 :Messages 300
:Slack 300 :Slack 300
:Telegram 300
:Twitterrific 300 :Twitterrific 300
}) })
(spoon.Quitter:start) (spoon.Quitter:start)

Loading…
Cancel
Save