pqrs-org / Karabiner-Elements

Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later.
https://pqrs.org/osx/karabiner/
The Unlicense
18.82k stars 838 forks source link

React to ScrollWheel in from-event #1362

Open wedi opened 6 years ago

wedi commented 6 years ago

Hi, I got into the habbit using ctrl + left/right scroll to switch desktops. Unfortunately, I still haven't found a way to achieve this with Karabiner Elements.

Does anyone know a way to make this work? I am looking for a way to react to horizontal ScrollWheel events. As to-event this is documented but unfortunately I haven't found anything about a correspondig from-event.

Thank you!

Related Issues: https://github.com/tekezo/Karabiner-Elements/issues/261#issuecomment-339164627, #579, #1066, #1113, https://github.com/tekezo/Karabiner/issues/814

scrollwheel

In the old days it used to work this way:

<autogen>
    __ScrollWheelToKey__
    ScrollWheel::RIGHT, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_CONTROL,
    KeyCode::CURSOR_LEFT,  MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_CONTROL,
</autogen>

1066 describes exactly how this was achieved earlier:

The previous version of Karabiner allowed one to reference ScrollWheel::Left and ScrollWheel::Right in the "from" field of mappings. I have not been able to find any documentation on how to do this in Karabiner-Elements.

In Karabiner-EventViewer I just see a "ScrollWheel" event come in along with "misc" data: "dx: -2.10 dy: 0.00 dz: 0:00".

nathanko711 commented 6 years ago

Hey I would love to know this as well, using left/right scroll to map to back/forward buttons would be pretty awesome.

wedi commented 6 years ago

Just stumbled upon one more related issue: #1314 There is a simple modification TO a mouse scroll event but not FROM:

from_mouse_key From key

to_mouse_key To key

Also see this (closed) pull request: #1230

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

wedi commented 6 years ago

Is there absolutely no solution to remap left/right scrolling? Not even a slight hint? What a pity.

hakanersu commented 6 years ago

Yes i found that in old versions there is a way to do that which i really need that with my sculpt mouse.

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <devicevendordef>
    <vendorname>MICROSOFT</vendorname>
    <vendorid>0x045e</vendorid>
  </devicevendordef>
  <deviceproductdef>
    <productname>MICROSOFT_SCULPT_MOUSE</productname>
    <productid>0x07a2</productid>
  </deviceproductdef>
  <item>
    <name>Microsoft Sculpt Mouse - Map Windows Button</name>
    <identifier>private.msft_sculpt</identifier>
    <device_only>
        DeviceVendor::MICROSOFT, 
        DeviceProduct::MICROSOFT_SCULPT_MOUSE
    </device_only>
    <autogen>
        __KeyToKey__
        KeyCode::CONTROL_L,
        KeyCode::VK_NONE,
        ModifierFlag::NONE
    </autogen>
    <autogen>
        __KeyOverlaidModifier__
        KeyCode::COMMAND_L,
        KeyCode::COMMAND_L,
        KeyCode::LAUNCHPAD
    </autogen>
    <autogen>
        __KeyToKey__
        KeyCode::DELETE,
        ModifierFlag::COMMAND_L,
        KeyCode::MISSION_CONTROL
    </autogen>
    <autogen>
        __KeyToKey__
        KeyCode::TAB,
        ModifierFlag::COMMAND_L,
        KeyCode::CURSOR_DOWN,
        ModifierFlag::CONTROL_L
    </autogen>
    <autogen>
        __ScrollWheelToKey__
        ScrollWheel::LEFT,
        ModifierFlag::COMMAND_L,
        KeyCode::CURSOR_LEFT,
        ModifierFlag::CONTROL_L
    </autogen>
    <autogen>
        __ScrollWheelToKey__
        ScrollWheel::RIGHT,
        ModifierFlag::COMMAND_L,
        KeyCode::CURSOR_RIGHT,
        ModifierFlag::CONTROL_L
    </autogen>
    <autogen>
        __FlipScrollWheel__
        Option::FLIPSCROLLWHEEL_VERTICAL,
        Option::FLIPSCROLLWHEEL_HORIZONTAL
    </autogen>
  </item>
</root>
wedi commented 6 years ago

Thanks for the hint! Unfortunately this is a configuration for the legacy Karabiner (as one can tell from the XML format) not the current Karabiner Elements. The new version has no obvious support for this and I couldn't find a workaround yet.

karlapsite commented 6 years ago

Bump: wouldn't mind being able to rebind scroll wheel to perform certain actions.

I'm trying to zoom in and out using a scroll wheel in Zeplin, so I need to rebind wheel up to ⌘ + and wheel down to ⌘ -.

calvinwyoung commented 6 years ago

Has anyone found a workaround for this? I'm also looking for a solution right now.

zgeist27 commented 6 years ago

I'm looking for this, too.

VVakko commented 5 years ago

I miss this feature too.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

FuegoFro commented 5 years ago

To feed the stale bot, I'll chime in that I'd also love for this feature to be implemented.

chavlji commented 5 years ago

I also desperately need wheel up/down as from key. I need it to:

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

sterling commented 5 years ago

Still a pretty significant missing piece of functionality.

krzysztofwolski commented 5 years ago

As a new MS Sculpt user I'm also interested in this func.

RainbowTraveller commented 5 years ago

Yes. Need ability to scroll using scroll wheel....!

piotrtobolski commented 5 years ago

Any news?

stianhoiland commented 5 years ago

I would like to see this, too! I'm looking to change what happens when the scroll wheel is scrolled up or down, for example to remove acceleration.

SolusCado commented 5 years ago

Are there plans to implement this support?

I used to use Razer's Synapse software with my Razer Nostromo to - among other things - control the system volume from the scroll wheel. As of now (in Catalina's latest beta), Razer Synapse doesn't work - so I'm finally getting around to remapping everything with Karabiner Elements instead. This ALMOST works great (better than Synapse, in terms of speed and reliability).

The problem of course is that Karabiner Elements doesn't seem to support scroll wheel events. Is there a technical reason for that? In the meantime, I'm using BetterTouchTool to at least let me control volume through a scroll wheel+modifer key combination, but it isn't as smooth as what I had before, and what I would imagine we would get from KE.

So, for what it's worth... +1 on this request!!

yanickxia commented 5 years ago

waiting for it....

Vxider commented 5 years ago

I'm looking for this, too.

kpau commented 5 years ago

+1

fogrid commented 5 years ago

Yea, I would like this feature too - I really want to be able to zoom with the mouse

prasskaly commented 4 years ago

I would like to have the feature of Ctrl+scroll up/down to zoom in/zoom out. Firefox supports this mode for macOS, but I want it to natively run in all apps that will be only possible with a tool like Karabiner.

kerryj89 commented 4 years ago

Since it's already understood in the to-event it should be trivial to understand from the from-event, no? Of course you and I both know things aren't always as simple as they seem. Still, some acknowledgement from the maintainer would be nice as to whether or not support for this will be coming. As of now I'm using BetterTouchTool which works for me (was already running it).

the-eric-kwok commented 4 years ago

+1

huseyinyagli commented 4 years ago

I'm missing this feature to reverse my mouse scroll without reversing trackpad scroll.

donmurdoc commented 4 years ago

I'm going crazy trying to do this!

catkic commented 4 years ago

+1

telemakhos commented 4 years ago

+1... looks like the old version of Karabiner was more versatile than current one...

stephancasas commented 4 years ago

+1

miticous commented 4 years ago

+1

cipri-tom commented 4 years ago

for people needing versatile Mouse events, I would recommend USB Overdrive. I'm new to mac (2 years) and started using that before discovering Karabiner, as I needed to keep natural scroll on the trackpad and not on the mouse. Now I'm using both: Karabiner for keyboard, USB Overdrive for mouse.

While it is not free, it is nag-ware. You have to wait 30 seconds when you want to enter the settings panel. I've used it like that for 2 years without a problem (I paid it now that I have a decent salary).

ibehnam commented 4 years ago

Still waiting for this functionality in 2020...

wedi commented 4 years ago

This ticket is getting close to the top in the most commented list. 😆

@tekezo Could you give an estimate if you are planning to implement this at some time or if we should just use an alternative like USB Overdrive for this particular feature?

Please get me right, this is an open source project you do in your spare time and I am really grateful for what I get right now. It's just for us/me to know.

drhisham-code commented 4 years ago

really miss this functionality

drhisham-code commented 4 years ago

bump

drhisham-code commented 4 years ago

bump

dts88 commented 4 years ago

Yes. I do need to have a react to Scroll_Wheel in from-event too. Now it just has "event type" with misc. No "name" or "code". can not control it.

cjh9 commented 4 years ago

This would be awesome if this functionality was implemented :)

radman0x commented 3 years ago

I've found my way here too, want to be able to map the mouse wheel + a modifier to zoom apps in and out. Hopefully there's time to look at this feature at some point :)

cipri-tom commented 3 years ago

@radman0x I understand your need :D. Most apps can already do that (web brosers, code editors, etc). This is great because they can zoom in "smartly" depending on their content.

Otherwise, on mac, you can enable an accessibility feature that zoom the whole screen: Settings > Accessibility > Zoom > Use scroll gesture with modifier keys to zoom . Enable this, and select the modifier you want (Ctrl, Option, Cmd). There are also 2 styles of zoom, see which one you like better.

Trinistar commented 3 years ago

+1

epjnano commented 3 years ago

+1, trying to find any method at all to remap scrolls on Mac, and Karabiner is the closest thing I've found (USB Overdrive doesn't cut it since I'm not using a USB/BT mouse)...would really love to see this implemented!

ghost commented 3 years ago

I noticed that 'scrollwheel functionality' is slated on the road map.

Maybe the following will be useful for someone: attached is Swift code I hobbled together today to make a tiny little 'scroll_to_left_right_arrows' CLI program. A user can launch such a program as part of a Karabiner Custom Command. I think this workaround can implement many of the use-cases for the requested feature (until such time as dev implements the feature).

main.swift.txt

What my "scroll_to_left_right_arrows" program does is [1] listen for scroll events, and convert them to left and right arrow keypresses (a more sophisticated version would actually throttle according to the deltaY values, but I hacked this together in a couple hours, so I didn't bother) [2] as soon as the user creates any keypress or click, the program exits (which, if anyone edits my program,they should be mindful of, since without exiting, you won't be able to operate any thing at all except left and right arrow! At one point today I absent-mindedly made a version that didn't exit, and had to reboot my Mac!).

My Complex Karabiner command to start it up looks like this (when the user presses F16, Karabiner presses Fn F2 to select the Apple Menu, and then runs my helper tool so the user can scroll left or right through the Menu bar)

    { 
        "description": "F16 âžž Menu", "manipulators": [
            {
            "type": "basic",
            "from": { "key_code": "f16" },
            "to": [
                    { "key_code": "f2", "modifiers": ["control"] },
                    { "key_code": "down_arrow", "repeat": false }
                ],
            "to_after_key_up": [
                    { "shell_command": "~/bin/scroll_to_left_right_arrows" }
                ]
            }
        ]
    } 
DKroot commented 3 years ago

Please, please... Accidental zooms with Crtl+Scroll on Mac drive me nuts. Even though this "feature" can be turned off in Accessibility, apps like Chrome and Excel still do it with no easy way to disable (there is a Chrome extension for it). I'd love to be able to disable this system-wide.

wedi commented 3 years ago

As @uniqueidentifier posted, @tekezo has put it on the roadmap but I wouldnt' be too optimistic about it speeding up this issue. 😉 Personally, I've made my peace with this situation as Karabiner is great without this feature already but I totally understand people not being happy about this.

Loakesy commented 3 years ago

+99

scrapix commented 3 years ago

Mouse Wheel Functions would be great indeed, maybe we can support with some donations :)