Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch scroll wheel events? #938

Closed
thalesmello opened this issue Jul 20, 2016 · 8 comments
Closed

Watch scroll wheel events? #938

thalesmello opened this issue Jul 20, 2016 · 8 comments

Comments

@thalesmello
Copy link

I'm interested in creating some scroll wheel based mappings in order to enable horizontal scroll in my terminal emulator.

I was wondering if it's possible to create a watch for ScrollWheel events using hammerspoon.

I so far haven't found anything like this. Thanks in advance.

@heptal
Copy link
Contributor

heptal commented Jul 20, 2016

hs.eventtap has a scrollWheel event.

@thalesmello
Copy link
Author

@heptal Is there any example on how to watch scroll events?

@asmagill
Copy link
Member

z = hs.eventtap.new({hs.eventtap.event.types.scrollWheel}, function(e)
    print(e:getProperty(hs.eventtap.event.properties.scrollWheelEventDeltaAxis1),
          e:getProperty(hs.eventtap.event.properties.scrollWheelEventDeltaAxis2))
end):start()

There are other properties that might apply as well... check help.hs.eventtap.event.properties or https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/index.html#//apple_ref/c/tdef/CGEventField.

@cmsj
Copy link
Member

cmsj commented Aug 23, 2016

(I'm going to close this out because I don't think there is any work to be done in Hammerspoon. Please re-open if you disagree!)

@cmsj cmsj closed this as completed Aug 23, 2016
@sheldond
Copy link

I'm interested in tracking a single mouse wheel scroll event (imagine a clicky mousewheel, not a Mac trackpad). And I'd like to distinguish the direction of the scroll (up or down). However I couldn't find a way yet. @asmagill's example will always print 0 0 regardless of which direction I scroll, I've looked at all properties starting with "scrollWheelEvent". This may be a Mac limitation, not Hammerspoon? Any ideas? Thanks! 😄

@asmagill
Copy link
Member

If the hardware or driver for the mouse is converting the scroll wheel actions into something else (arrow keys, pageUp/pageDown, etc.) then it may not be possible for us to get at these events since they've been changed into something else.

Off the top of my head, if none of the scrollWheel events or properties are providing any data, then my suspicion is that we may not be able to do anything about it.

What is the make and model of the mouse? A quick google search may show if people have found a way around this for your specific model... or at the very least allow us to start a list of known problematic hardware.

@sheldond
Copy link

Thanks for your reply! I tested two mice, both results the same:

  • Logitech Wireless Trackball M570
  • Razer DeathAdder 2013

I noticed that if I scroll many times quickly, then the numbers will begin to change to something like

0	0
0	0
0	0
0	0
0	0
-1	0
-4	0
-7	0
-10	0

So I can detect when lots of quick scrolling is happening, but not individual events.

@weitzj
Copy link

weitzj commented Mar 29, 2017

If anyone is interested to use the Trackball of the M570 as a vertical/horizontal Scrollwheel in Hammerspoon: pqrs-org/Karabiner-archived#814

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants