Skip to content

Instantly share code, notes, and snippets.

@asmagill
Created August 1, 2015 19:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asmagill/251f8ea70b61a177a205 to your computer and use it in GitHub Desktop.
Save asmagill/251f8ea70b61a177a205 to your computer and use it in GitHub Desktop.
Auto hide Hammerspoon console when it loses focus
--
-- 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