Created
August 1, 2015 19:42
-
-
Save asmagill/251f8ea70b61a177a205 to your computer and use it in GitHub Desktop.
Auto hide Hammerspoon console when it loses focus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Basic console auto-hide when Hammerspoon loses focus | |
-- | |
-- ConsoleWatcher:start() | |
-- Turns on the watcher, and the Hammerspoon console, if open, will close when you enter another application | |
-- ConsoleWatcher:stop() | |
-- Turns off the watcher; Hammerspoon console open/close state is left untouched. | |
ConsoleWatcher = hs.application.watcher.new(function(name,event,hsapp) | |
if name then | |
if name:match("Hammerspoon") and event == hs.application.watcher.deactivated then | |
local test = hs.appfinder.windowFromWindowTitle("Hammerspoon Console") | |
if test then test:close() end | |
end | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment