Skip to content

Instantly share code, notes, and snippets.

@szhu
Created December 20, 2022 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save szhu/6086b9db2b4b0700045e43209a7e0cc2 to your computer and use it in GitHub Desktop.
Save szhu/6086b9db2b4b0700045e43209a7e0cc2 to your computer and use it in GitHub Desktop.
HammerSpoon script for scroll to zoom with no modifiers
-- https://forum.kicad.info/t/zoom-with-scroll-wheel-but-pan-with-trackpad-on-macos/11974
figmaScrollToZoom = hs.eventtap.new({hs.eventtap.event.types.scrollWheel}, function(e)
-- Trackpad scroll events are continuous, mouse scroll events are not.
if 0 == e:getProperty(hs.eventtap.event.properties.scrollWheelEventIsContinuous) then
local front = hs.application.frontmostApplication()
if "Figma" == front:name() then
-- local title = front:focusedWindow():title()
-- if "Eeschema" == title:sub(0, 8) or "Pcbnew" == title:sub(0, 6) then
local flags = e:getFlags()
flags['cmd'] = true
e:setFlags(flags)
--else
--print(title)
-- end
end
end
end):start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment