From 68ebf7c9ce34b33b78a91b08c4390bc2ad85f140 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Thu, 2 Dec 2021 15:05:25 -0800 Subject: [PATCH] [hammerspoon] quitter tweaks - Don't kill Discord for now (for Advent of Code!) - Kill apps on unfocused time, not on last focused time --- .hammerspoon/Spoons/Quitter.spoon/init.lua | 6 +++--- .hammerspoon/init.fnl | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.hammerspoon/Spoons/Quitter.spoon/init.lua b/.hammerspoon/Spoons/Quitter.spoon/init.lua index 4018f76..2d1a887 100644 --- a/.hammerspoon/Spoons/Quitter.spoon/init.lua +++ b/.hammerspoon/Spoons/Quitter.spoon/init.lua @@ -12,7 +12,7 @@ obj.version = "0.1" obj.author = "Alpha Chen " obj.license = "MIT - https://opensource.org/licenses/MIT" -obj.logger = hs.logger.new("quitter") +obj.logger = hs.logger.new("quitter", "debug") obj.lastFocused = {} --- Quitter.quitAppsAfter @@ -40,9 +40,9 @@ function obj:start() for app, _ in pairs(self.quitAppsAfter) do self.windowFilter:allowApp(app) 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() - obj.lastFocused[name] = os.time() + self.lastFocused[name] = os.time() end) self.timer = hs.timer.doEvery(60, function() diff --git a/.hammerspoon/init.fnl b/.hammerspoon/init.fnl index 63c6c36..7faca17 100644 --- a/.hammerspoon/init.fnl +++ b/.hammerspoon/init.fnl @@ -2,6 +2,7 @@ (set hs.window.animationDuration 0.0) (hs.loadSpoon "MiroWindowsManager") +(set spoon.MiroWindowsManager.fullScreenSizes [1]) ;; only fullscreen (let [mash [:cmd :alt :ctrl] smash [:cmd :alt :ctrl :shift]] (spoon.MiroWindowsManager:bindHotkeys { @@ -10,9 +11,9 @@ :down [ mash "j" ] :right [ mash "l" ] :fullscreen [ mash "m" ] - :center [ mash "c" ] - :move [ smash "m" ] - :resize [ mash "d" ] + ;; :center [ mash "c" ] + ;; :move [ smash "m" ] + ;; :resize [ mash "d" ] })) (let [mash [:cmd :alt :ctrl] @@ -42,11 +43,12 @@ (hs.loadSpoon "Quitter") (set spoon.Quitter.quitAppsAfter { - :Discord 300 + ;; :Discord 300 :Flotato 300 :MailMate 300 :Messages 300 :Slack 300 + :Telegram 300 :Twitterrific 300 }) (spoon.Quitter:start)