Created
September 13, 2022 23:26
-
-
Save latenitefilms/5e1a264fde729da7ab41e37198085af5 to your computer and use it in GitHub Desktop.
Middle Mouse Hold
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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