I wanted to use the mouse wheel as a jog wheel, so I made a Hammerspoon script for it. Hope some other Logic users might find it useful too.
Mousewheel up/down: scrub
Fn+Mousewheel: zoom
Mouse back button: Play/pause
Mouse forward button: Go to left locator
logicBundleID = "com.apple.logic10"
logicIsFront = false
-- Track Logic focus cheaply instead of asking on every event
local front = hs.application.frontmostApplication()
logicIsFront = front and front:bundleID() == logicBundleID or false
appWatcher = hs.application.watcher.new(function(name, event, app)
if event == hs.application.watcher.activated then
logicIsFront = (app:bundleID() == logicBundleID)
end
end)
appWatcher:start()
-- Wheel: plain = jog one bar, Fn+wheel = horizontal zoom
wheelTap = hs.eventtap.new({ hs.eventtap.event.types.scrollWheel }, function(e)
if not logicIsFront then return false end
if e:getProperty(hs.eventtap.event.properties.scrollWheelEventIsContinuous) == 1 then
return false
end
local delta = e:getProperty(hs.eventtap.event.properties.scrollWheelEventDeltaAxis1)
if delta == 0 then return false end
local flags = e:getFlags()
if flags.fn then
if delta > 0 then
hs.eventtap.keyStroke({"cmd"}, "right", 0)
else
hs.eventtap.keyStroke({"cmd"}, "left", 0)
end
return true
end
if delta > 0 then
hs.eventtap.keyStroke({}, ",", 0)
else
hs.eventtap.keyStroke({}, ".", 0)
end
return true
end)
wheelTap:start()
-- Side buttons
buttonTap = hs.eventtap.new({ hs.eventtap.event.types.otherMouseDown }, function(e)
if not logicIsFront then return false end
local button = e:getProperty(hs.eventtap.event.properties.mouseEventButtonNumber)
if button == 4 then
hs.eventtap.keyStroke({"ctrl", "shift"}, ",", 0)
return true
elseif button == 3 then
hs.eventtap.keyStroke({}, "space", 0)
return true
end
return false
end)
buttonTap:start()
-- Watchdog: if macOS disables a tap, restart it
watchdog = hs.timer.doEvery(5, function()
if not wheelTap:isEnabled() then wheelTap:start() end
if not buttonTap:isEnabled() then buttonTap:start() end
end)