Open jeffmikels opened 7 years ago
I believe "Hammerspoon" can do it, just google "hammerspoon scroll wheel". Many people switch to hammerspoon after Sierra due to Karabiner is not supported in Sierra.
Thanks!
Following up on this: I have been able to successfully reproduce the Karabiner Virtual Scroll using Hammerspoon. For those who are interested, here is my hammerspoon code:
-- HANDLE SCROLLING
local oldmousepos = {}
local scrollmult = -4 -- negative multiplier makes mouse work like traditional scrollwheel
mousetap = hs.eventtap.new({5}, function(e)
oldmousepos = hs.mouse.getAbsolutePosition()
local mods = hs.eventtap.checkKeyboardModifiers()
if mods['ctrl'] and mods['cmd'] then
-- print ("will scroll")
local dx = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaX'])
local dy = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaY'])
local scroll = hs.eventtap.event.newScrollEvent({dx * scrollmult, dy * scrollmult},{},'pixel')
scroll:post()
-- put the mouse back
hs.mouse.setAbsolutePosition(oldmousepos)
-- return true, {scroll}
return true
else
return false, {}
end
-- print ("Mouse moved!")
-- print (dx)
-- print (dy)
end)
mousetap:start()
If anyone is interested:
I have adopted the above answer, which allows me to scroll vertically/horizontally using my Logitech M570 (Trackball), while holding a mouse button (instead of ctrl
+ cmd
)
-- HANDLE SCROLLING
local oldmousepos = {}
-- positive multiplier (== natural scrolling) makes mouse work like traditional scrollwheel
local scrollmult = 4
-- The were all events logged, when using `{"all"}`
mousetap = hs.eventtap.new({0,3,5,14,25,26,27}, function(e)
oldmousepos = hs.mouse.getAbsolutePosition()
local mods = hs.eventtap.checkKeyboardModifiers()
local pressedMouseButton = e:getProperty(hs.eventtap.event.properties['mouseEventButtonNumber'])
-- If OSX button 4 is pressed, allow scrolling
local shouldScroll = 3 == pressedMouseButton
if shouldScroll then
local dx = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaX'])
local dy = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaY'])
local scroll = hs.eventtap.event.newScrollEvent({dx * scrollmult, dy * scrollmult},{},'pixel')
scroll:post()
-- put the mouse back
hs.mouse.setAbsolutePosition(oldmousepos)
return true, {scroll}
else
return false, {}
end
-- print ("Mouse moved!")
-- print (dx)
-- print (dy)
end)
mousetap:start()
I had the same problem, but I prefer to use right mouse button to init scrolling, so I used your code and modified it to perform scroll during right mouse drag. There was some problems with deferring menuOpen on rightMouseDown, but I ended with this script, which works great.
Note: this will make right mouse dragging impossible, but who needs it anyway?
-- HANDLE SCROLLING
local deferred = false
overrideRightMouseDown = hs.eventtap.new({ hs.eventtap.event.types.rightMouseDown }, function(e)
--print("down"))
deferred = true
return true
end)
overrideRightMouseUp = hs.eventtap.new({ hs.eventtap.event.types.rightMouseUp }, function(e)
-- print("up"))
if (deferred) then
overrideRightMouseDown:stop()
overrideRightMouseUp:stop()
hs.eventtap.rightClick(e:location())
overrideRightMouseDown:start()
overrideRightMouseUp:start()
return true
end
return false
end)
local oldmousepos = {}
local scrollmult = -4 -- negative multiplier makes mouse work like traditional scrollwheel
dragRightToScroll = hs.eventtap.new({ hs.eventtap.event.types.rightMouseDragged }, function(e)
-- print("scroll");
deferred = false
oldmousepos = hs.mouse.getAbsolutePosition()
local dx = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaX'])
local dy = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaY'])
local scroll = hs.eventtap.event.newScrollEvent({dx * scrollmult, dy * scrollmult},{},'pixel')
-- put the mouse back
hs.mouse.setAbsolutePosition(oldmousepos)
return true, {scroll}
end)
overrideRightMouseDown:start()
overrideRightMouseUp:start()
dragRightToScroll:start()
Can this be restricted to one particular device?
@3rd3 you can enable/disable Hammerspoon functions when device is un-/plugged from computer with hs.usb.watcher or as a result of launch/exit of some application with hs.application.watcher, but I could not find a way, how to limit functionality only to certain device, not the hs.eventtap nor the hs.eventtap.event seem to provide a information about device which triggered the mouse event.
Yet another modification for using a Logitech Trackman Marble Trackball. weitzj's code above works as-is if you use the small left button to scroll. I use the trackball with my left hand, so I like using the right small button with my thumb to enable scrolling. I also like rolling down to scroll down, so I use the negative multiplier. For convenience, here's the code.
`
-- Enable virtual mouse scroll wheel with trackball while pressing small mouse button
local oldmousepos = {}
-- positive multiplier = natural scrolling, negative makes mouse work like traditional scroll wheel
local scrollmult = -4
-- There were all events logged, when using `{"all"}`
mousetap = hs.eventtap.new({0,3,5,14,25,26,27}, function(e)
oldmousepos = hs.mouse.getAbsolutePosition()
local mods = hs.eventtap.checkKeyboardModifiers()
local pressedMouseButton = e:getProperty(hs.eventtap.event.properties['mouseEventButtonNumber'])
-- If small mouse button is pressed, allow scrolling with trackball
-- 3 = left small button, 4 = right small button
local shouldScroll = 4 == pressedMouseButton
if shouldScroll then
local dx = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaX'])
local dy = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaY'])
local scroll = hs.eventtap.event.newScrollEvent({dx * scrollmult, dy * scrollmult},{},'pixel')
scroll:post()
-- put the mouse back
hs.mouse.setAbsolutePosition(oldmousepos)
return true, {scroll}
else
return false, {}
end
end)
mousetap:start()
`
Hey randydod, any way you could modify the above code for me for karabiner elements? I want to hold the left shift modifier and have my kensington expert trackball scroll; up, down, left, right etc. Rolling down scrolls down. Also, how do I even load this code?
Needless to say I have to experience with karabiner
greazyfingaz, the last time I checked (Jan 11, 2018), Karabiner Elements cannot do this. My code is for Hammerspoon. Use jeffmikels' code above (his 2/21/17 post) and replace his "if mods['ctrl'] and mods['cmd'] then" line with this line instead: if mods['shift'] then
As far as I can tell, Hammerspoon does not have the ability to distinguish between the left and right shift keys, so the code will make scrolling work with either shift key.
http://www.hammerspoon.org/go can help you get started using it.
Thanks I'll try this!...
On Jan 31, 2018 7:42 AM, "Randy Dod" notifications@github.com wrote:
greazyfingaz, the last time I checked (Jan 11, 2018), Karabiner Elements cannot do this. My code is for Hammerspoon. Use jeffmikels' code above (his 2/21/17 post) and replace his "if mods['ctrl'] and mods['cmd'] then" line with this line instead: if mods['shift'] then
As far as I can tell, Hammerspoon does not have the ability to distinguish between the left and right shift keys, so the code will make scrolling work with either shift key.
http://www.hammerspoon.org/go can help you get started using it.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tekezo/Karabiner/issues/814#issuecomment-361971600, or mute the thread https://github.com/notifications/unsubscribe-auth/AiU9U0IrG3d2Sqoo6fjF8gbP7W-0E3GHks5tQImsgaJpZM4L9g_5 .
Thanks again! Worked perfectly!
On Wed, Jan 31, 2018 at 2:43 PM, Joel O'Neill joelbassist@gmail.com wrote:
Thanks I'll try this!...
On Jan 31, 2018 7:42 AM, "Randy Dod" notifications@github.com wrote:
greazyfingaz, the last time I checked (Jan 11, 2018), Karabiner Elements cannot do this. My code is for Hammerspoon. Use jeffmikels' code above (his 2/21/17 post) and replace his "if mods['ctrl'] and mods['cmd'] then" line with this line instead: if mods['shift'] then
As far as I can tell, Hammerspoon does not have the ability to distinguish between the left and right shift keys, so the code will make scrolling work with either shift key.
http://www.hammerspoon.org/go can help you get started using it.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tekezo/Karabiner/issues/814#issuecomment-361971600, or mute the thread https://github.com/notifications/unsubscribe-auth/AiU9U0IrG3d2Sqoo6fjF8gbP7W-0E3GHks5tQImsgaJpZM4L9g_5 .
One more question for you:
Is there some kind of command line I could add to this so that if Im holding down shift + another modifier or key it will NOT scroll? (Pro Tools)
On Jan 31, 2018 4:16 PM, "Joel O'Neill" joelbassist@gmail.com wrote:
Thanks again! Worked perfectly!
On Wed, Jan 31, 2018 at 2:43 PM, Joel O'Neill joelbassist@gmail.com wrote:
Thanks I'll try this!...
On Jan 31, 2018 7:42 AM, "Randy Dod" notifications@github.com wrote:
greazyfingaz, the last time I checked (Jan 11, 2018), Karabiner Elements cannot do this. My code is for Hammerspoon. Use jeffmikels' code above (his 2/21/17 post) and replace his "if mods['ctrl'] and mods['cmd'] then" line with this line instead: if mods['shift'] then
As far as I can tell, Hammerspoon does not have the ability to distinguish between the left and right shift keys, so the code will make scrolling work with either shift key.
http://www.hammerspoon.org/go can help you get started using it.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tekezo/Karabiner/issues/814#issuecomment-361971600, or mute the thread https://github.com/notifications/unsubscribe-auth/AiU9U0IrG3d2Sqoo6fjF8gbP7W-0E3GHks5tQImsgaJpZM4L9g_5 .
I encourage you to dig through Hammerspoon's documentation, as that's what I would have to do to figure this out. In other words, I don't know how. A brief reading of their examples reveals that apparently it cannot discern between the left and right shift keys or other dual keys. It can interface w/ Karabiner (see http://www.hammerspoon.org/go/#karabinerurl), which does not work in Sierra, but it does not mention Karabiner Elements.
Looking through their docs, http://www.hammerspoon.org/docs/, these functions look the most promising. hs.eventtap, hs.eventtap.event, hs.expose, hs.keycodes
You might post your question by itself to see if someone else here would know how to do this.
@greazyfingaz Yes. Look through the code above. You want to add an "if" statement that checks if specific modifier keys are down, and if they are down, sets "shouldScroll" to false.
Are you familiar with how to write code?
@randydod-teamunify thanks for the hammerspoon modification!
For future users, I found out, through experimentation, that the left small mouse button is actually index "2" on my trackman marble.
Thanks for the scripts everyone, worked well for me! To get @randydod-teamunify's script working, I had to go into the logitech settings and set the button number for the small buttons manually:
getting error
2018-07-10 10:16:44: 10:16:44 ERROR: LuaSkin: hs.shutdownCallback: attempt to call a nil value stack traceback:
with this code https://github.com/tekezo/Karabiner/issues/814#issuecomment-281422447
hammerspoon - Version 0.9.66 (0.9.66)
Leaving my script for scrolling with mouse wheel pressed. Mouse wheel button in my case is 2. The button is configurable on the second line of code. Natural scrolling on both axes:
-- HANDLE SCROLLING WITH MOUSE BUTTON PRESSED
local scrollMouseButton = 2
local deferred = false
overrideOtherMouseDown = hs.eventtap.new({ hs.eventtap.event.types.otherMouseDown }, function(e)
-- print("down")
local pressedMouseButton = e:getProperty(hs.eventtap.event.properties['mouseEventButtonNumber'])
if scrollMouseButton == pressedMouseButton
then
deferred = true
return true
end
end)
overrideOtherMouseUp = hs.eventtap.new({ hs.eventtap.event.types.otherMouseUp }, function(e)
-- print("up")
local pressedMouseButton = e:getProperty(hs.eventtap.event.properties['mouseEventButtonNumber'])
if scrollMouseButton == pressedMouseButton
then
if (deferred) then
overrideOtherMouseDown:stop()
overrideOtherMouseUp:stop()
hs.eventtap.otherClick(e:location(), 0, pressedMouseButton)
overrideOtherMouseDown:start()
overrideOtherMouseUp:start()
return true
end
return false
end
return false
end)
local oldmousepos = {}
local scrollmult = -4 -- negative multiplier makes mouse work like traditional scrollwheel
dragOtherToScroll = hs.eventtap.new({ hs.eventtap.event.types.otherMouseDragged }, function(e)
local pressedMouseButton = e:getProperty(hs.eventtap.event.properties['mouseEventButtonNumber'])
-- print ("pressed mouse " .. pressedMouseButton)
if scrollMouseButton == pressedMouseButton
then
-- print("scroll");
deferred = false
oldmousepos = hs.mouse.getAbsolutePosition()
local dx = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaX'])
local dy = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaY'])
local scroll = hs.eventtap.event.newScrollEvent({-dx * scrollmult, dy * scrollmult},{},'pixel')
-- put the mouse back
hs.mouse.setAbsolutePosition(oldmousepos)
return true, {scroll}
else
return false, {}
end
end)
overrideOtherMouseDown:start()
overrideOtherMouseUp:start()
dragOtherToScroll:start()
@Burdu Thanks for that script! Your version won't completely disable the chosen mouse button, so I can still use my extra buttons for back and forward actions.
Just a note: on line number 23 (hs.eventtap.otherClick(e:location(), pressedMouseButton)
) I had to move the second parameter to the third position (by adding 0
as the second parameter) because the second parameter is the click delay and not the mouse button number. Other than that minor issue, your code is definitely the best on this thread.
Thanks, I updated the script to fix that
I see a lot of hammerspoon masters here. Does anyone know how to replicate the firefox auto-scroll (mousewheel click) feature with HS? I want to press a button and have the screen scroll down until I press it again, without holding anything, is it possible?
Yes, the scripts above indicate how to send a scroll event. You need to wrap it in a hs.timer.doEvery function call , and you need to set a hotkey to start and stop that timer.
On Thu, Nov 8, 2018, 12:21 AM Madd0g notifications@github.com wrote:
I see a lot of hammerspoon masters here. Does anyone know how to replicate the firefox auto-scroll feature with HS? I want to press a button and have the screen scroll down until I press it again, without holding anything, is it possible?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tekezo/Karabiner/issues/814#issuecomment-436876883, or mute the thread https://github.com/notifications/unsubscribe-auth/ADV_ZEIk2myx0v6scuC0tmS3nWjNxGqUks5us79ugaJpZM4L9g_5 .
@jeffmikels - thanks, I'll try, I was a bit worried about jerkiness from using a timer, but I guess I'll tweak the timer/scroll values until it looks ok. Thanks
was soooo easy:
local timer = nil
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "s", function()
if timer == nil or not timer then
timer = hs.timer.doEvery(0.07, performScroll)
else
timer.stop(timer)
timer = nil
end
end)
function performScroll()
hs.eventtap.event.newScrollEvent({ 0, -2 }, {}, 'pixel'):post()
end
keywords: google chrome autoscroll page hammerspoon
For anyone who finds this thread via Google and is just looking for some damn mouse drivers:
hs.eventtap:start() Unable to create eventtap. Is Accessibility enabled?
follow the accessibility directions in the faq http://www.hammerspoon.org/faq/Edit local scrollmult = -4
to change direction and speed.
Thanks for sharing your code everybody!
FYI, on the Logitech Trackman, using the mini left button, I used @randydod-teamunify's code with these settings:
local shouldScroll = 4 == pressedMouseButton
, i.e. button no. 4No idea why/how those are mixed up. I suppose it's off-by-one somewhere ;-)
Huge thanks to everyone, this thread makes a normal mouse/trackball useable on a mac.
I wrote another version to help scrolling through big files and added a dead-zone for clicking (in other versions if you moved the mouse even 1 pixel between pressing and releasing the button it wouldn't fire the click):
------------------------------------------------------------------------------------------
-- AUTOSCROLL WITH MOUSE WHEEL BUTTON
-- timginter @ GitHub
------------------------------------------------------------------------------------------
-- id of mouse wheel button
local mouseScrollButtonId = 2
-- scroll speed and direction config
local scrollSpeedMultiplier = 0.1
local scrollSpeedSquareAcceleration = true
local reverseVerticalScrollDirection = false
local mouseScrollTimerDelay = 0.01
-- circle config
local mouseScrollCircleRad = 10
local mouseScrollCircleDeadZone = 5
------------------------------------------------------------------------------------------
local mouseScrollCircle = nil
local mouseScrollTimer = nil
local mouseScrollStartPos = 0
local mouseScrollDragPosX = nil
local mouseScrollDragPosY = nil
overrideScrollMouseDown = hs.eventtap.new({ hs.eventtap.event.types.otherMouseDown }, function(e)
-- uncomment line below to see the ID of pressed button
--print(e:getProperty(hs.eventtap.event.properties['mouseEventButtonNumber']))
if e:getProperty(hs.eventtap.event.properties['mouseEventButtonNumber']) == mouseScrollButtonId then
-- remove circle if exists
if mouseScrollCircle then
mouseScrollCircle:delete()
mouseScrollCircle = nil
end
-- stop timer if running
if mouseScrollTimer then
mouseScrollTimer:stop()
mouseScrollTimer = nil
end
-- save mouse coordinates
mouseScrollStartPos = hs.mouse.getAbsolutePosition()
mouseScrollDragPosX = mouseScrollStartPos.x
mouseScrollDragPosY = mouseScrollStartPos.y
-- start scroll timer
mouseScrollTimer = hs.timer.doAfter(mouseScrollTimerDelay, mouseScrollTimerFunction)
-- don't send scroll button down event
return true
end
end)
overrideScrollMouseUp = hs.eventtap.new({ hs.eventtap.event.types.otherMouseUp }, function(e)
if e:getProperty(hs.eventtap.event.properties['mouseEventButtonNumber']) == mouseScrollButtonId then
-- send original button up event if released within 'mouseScrollCircleDeadZone' pixels of original position and scroll circle doesn't exist
mouseScrollPos = hs.mouse.getAbsolutePosition()
xDiff = math.abs(mouseScrollPos.x - mouseScrollStartPos.x)
yDiff = math.abs(mouseScrollPos.y - mouseScrollStartPos.y)
if (xDiff < mouseScrollCircleDeadZone and yDiff < mouseScrollCircleDeadZone) and not mouseScrollCircle then
-- disable scroll mouse override
overrideScrollMouseDown:stop()
overrideScrollMouseUp:stop()
-- send scroll mouse click
hs.eventtap.otherClick(e:location(), mouseScrollButtonId)
-- re-enable scroll mouse override
overrideScrollMouseDown:start()
overrideScrollMouseUp:start()
end
-- remove circle if exists
if mouseScrollCircle then
mouseScrollCircle:delete()
mouseScrollCircle = nil
end
-- stop timer if running
if mouseScrollTimer then
mouseScrollTimer:stop()
mouseScrollTimer = nil
end
-- don't send scroll button up event
return true
end
end)
overrideScrollMouseDrag = hs.eventtap.new({ hs.eventtap.event.types.otherMouseDragged }, function(e)
-- sanity check
if mouseScrollDragPosX == nil or mouseScrollDragPosY == nil then
return true
end
-- update mouse coordinates
mouseScrollDragPosX = mouseScrollDragPosX + e:getProperty(hs.eventtap.event.properties['mouseEventDeltaX'])
mouseScrollDragPosY = mouseScrollDragPosY + e:getProperty(hs.eventtap.event.properties['mouseEventDeltaY'])
-- don't send scroll button drag event
return true
end)
function mouseScrollTimerFunction()
-- sanity check
if mouseScrollDragPosX ~= nil and mouseScrollDragPosY ~= nil then
-- get cursor position difference from original click
xDiff = math.abs(mouseScrollDragPosX - mouseScrollStartPos.x)
yDiff = math.abs(mouseScrollDragPosY - mouseScrollStartPos.y)
-- draw circle if not yet drawn and cursor moved more than 'mouseScrollCircleDeadZone' pixels
if mouseScrollCircle == nil and (xDiff > mouseScrollCircleDeadZone or yDiff > mouseScrollCircleDeadZone) then
mouseScrollCircle = hs.drawing.circle(hs.geometry.rect(mouseScrollStartPos.x - mouseScrollCircleRad, mouseScrollStartPos.y - mouseScrollCircleRad, mouseScrollCircleRad * 2, mouseScrollCircleRad * 2))
mouseScrollCircle:setStrokeColor({["red"]=0.3, ["green"]=0.3, ["blue"]=0.3, ["alpha"]=1})
mouseScrollCircle:setFill(false)
mouseScrollCircle:setStrokeWidth(1)
mouseScrollCircle:show()
end
-- send scroll event if cursor moved more than circle's radius
if xDiff > mouseScrollCircleRad or yDiff > mouseScrollCircleRad then
-- get real xDiff and yDiff
deltaX = mouseScrollDragPosX - mouseScrollStartPos.x
deltaY = mouseScrollDragPosY - mouseScrollStartPos.y
-- use 'scrollSpeedMultiplier'
deltaX = deltaX * scrollSpeedMultiplier
deltaY = deltaY * scrollSpeedMultiplier
-- square for better scroll acceleration
if scrollSpeedSquareAcceleration then
-- mod to keep negative values
deltaXDirMod = 1
deltaYDirMod = 1
if deltaX < 0 then
deltaXDirMod = -1
end
if deltaY < 0 then
deltaYDirMod = -1
end
deltaX = deltaX * deltaX * deltaXDirMod
deltaY = deltaY * deltaY * deltaYDirMod
end
-- math.floor - scroll event accepts only integers
deltaX = math.floor(deltaX)
deltaY = math.floor(deltaY)
-- reverse Y scroll if 'reverseVerticalScrollDirection' set to true
if reverseVerticalScrollDirection then
deltaY = deltaY * -1
end
-- send scroll event
hs.eventtap.event.newScrollEvent({-deltaX, deltaY}, {}, 'pixel'):post()
end
end
-- restart timer
mouseScrollTimer = hs.timer.doAfter(mouseScrollTimerDelay, mouseScrollTimerFunction)
end
-- start override functions
overrideScrollMouseDown:start()
overrideScrollMouseUp:start()
overrideScrollMouseDrag:start()
------------------------------------------------------------------------------------------
-- END OF AUTOSCROLL WITH MOUSE WHEEL BUTTON
------------------------------------------------------------------------------------------
keywords: mac mouse autoscroll hammerspoon wheel pressed
did anyone figure out how to have the scrollwheel scrolling feel more natural (scroll bigger distances, maybe accelerate a little bit?) I just can't shake the muscle memory of using the scrollwheel and it's a pretty horrible experience.
Thank you all for this. Could someone explain how to deactivate scrolling when a specific application is active? I did it that way: ` -- HANDLE SCROLLING local oldmousepos = {} -- positive multiplier (== natural scrolling) makes mouse work like traditional scrollwheel local scrollmult = 1
-- The were all events logged, when using {"all"}
mousetap = hs.eventtap.new({0,3,5,14,25,26,27}, function(e)
oldmousepos = hs.mouse.getAbsolutePosition()
local mods = hs.eventtap.checkKeyboardModifiers()
local pressedMouseButton = e:getProperty(hs.eventtap.event.properties['mouseEventButtonNumber'])
-- If OSX button 4 is pressed, allow scrolling local shouldScroll = 2 == pressedMouseButton if shouldScroll then local dx = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaX']) local dy = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaY']) local scroll = hs.eventtap.event.newScrollEvent({dx scrollmult, dy scrollmult},{},'pixel') scroll:post()
-- put the mouse back -- hs.mouse.setAbsolutePosition(oldmousepos)
return true, {scroll} else return false, {} end -- print ("Mouse moved!") -- print (dx) -- print (dy) end)
-- Define a callback function to be called when application events happen
function applicationWatcherCallback(appName, eventType, appObject) if (appName == "DaVinci Resolve") then if (eventType == hs.application.watcher.activated) then -- DaVinci just got focus, disable Scroll mousetap:stop() elseif (eventType == hs.application.watcher.deactivated) then -- DaVinci just lost focus, enable Scroll mousetap:start() end end end
-- Create and start the application event watcher watcher = hs.application.watcher.new(applicationWatcherCallback) watcher:start()
-- Activate the modal state
mousetap:start()`
It's working, but there is a glitch, there is a conflict between how Davinci handles middle mouse drag.
kek, the best answer (right mouse scroll) author deleted his account. It is the only way I found to do it on macosx without paying money for 3d party software.
You can change one of the above variants and make them use right mouse button for scroll. The button code is declared as variable.
I have a Logitech Marble Mouse, and I love it too much to switch to anything else, but having a scroll wheel is incredibly useful on a mac. Currently, I'm on El Capitan because Karabiner has a virtual scroll wheel feature where I can hold down CTL + CMD and then my trackball turns into a scroll wheel. It's the only thing preventing me from upgrading to Sierra.
I am a capable programmer, so I'd like to help development by enabling this one feature on Sierra, but I'd need some guidance. Can anyone help me enable virtual scroll wheel on Sierra?