Skip to content

Instantly share code, notes, and snippets.

@latenitefilms
Created September 13, 2022 23:26
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 latenitefilms/5e1a264fde729da7ab41e37198085af5 to your computer and use it in GitHub Desktop.
Save latenitefilms/5e1a264fde729da7ab41e37198085af5 to your computer and use it in GitHub Desktop.
Middle Mouse Hold
local currentTool
middleMouseButtonTap = hs.eventtap.new({hs.eventtap.event.types.otherMouseDown, hs.eventtap.event.types.otherMouseUp}, function(ev)
if cp.apple.finalcutpro.isFrontmost() then
local buttonState = ev:getButtonState(2)
if buttonState then
--------------------------------------------------------------------------------
-- Middle Mouse Button Pressed:
--------------------------------------------------------------------------------
currentTool = cp.apple.finalcutpro.timeline.toolbar.tool()
hs.eventtap.event.newKeyEvent("h", true):post()
else
--------------------------------------------------------------------------------
-- Middle Mouse Button Released:
--------------------------------------------------------------------------------
local whichShortcut = currentTool and currentTool.CommandSetID
cp.apple.finalcutpro:doShortcut(whichShortcut):Now()
end
end
end):start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment