Skip to content

Instantly share code, notes, and snippets.

@yrnehli
Last active September 18, 2024 19:34
Show Gist options
  • Save yrnehli/392f4eb234cc1d78fd61a31b1140a3bb to your computer and use it in GitHub Desktop.
Save yrnehli/392f4eb234cc1d78fd61a31b1140a3bb to your computer and use it in GitHub Desktop.
Hammerspoon script to hide active window when middle clicking top left of window
hs.eventtap.new(
{ hs.eventtap.event.types.otherMouseDown },
function(e)
local button = e:getProperty(
hs.eventtap.event.properties['mouseEventButtonNumber']
)
if button == 2 then
m = hs.mouse.absolutePosition()
a = hs.application.frontmostApplication()
f = hs.window.focusedWindow():frame()
if m.y > f.y and m.y < f.y + 35 then
if m.x > f.x and m.x < f.x + 70 then
a:hide()
end
end
end
end
):start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment