cajhin / capsicain

Powerful low-level keyboard remapping tool for Windows
349 stars 18 forks source link

Feature request: Mouse button support #39

Open ghost opened 3 years ago

ghost commented 3 years ago

I wonder if there would be any interest in mouse button support for Capsicain?

I don't expect anything too far beyond the existing behaviour; handling exactly the same as the existing keyboard support, but with M1-M5 buttons also, would be super useful. I would like to use my mouse buttons as keys, and vice-versa, to help address some medical issues with my hands.

I would be happy to assist with any code contributions you might need, if that helps any?

Great project, either way. Cheers!

cajhin commented 3 years ago

That shouldn't be too hard, Interception can deal with mice (just a couple of flags to change). I didn't do it because of performance (mice send a LOT of updates when you move them; I would make this optional via config switch). An unsolved issue is that I would first need to map the mouse buttons to (virtual or real) keys, since the 'rule engine' only knows keys. Can you give examples of what exactly you intend to do with the mouse buttons? It's not a use case for me, so I might be missing the point.

ghost commented 3 years ago

Hey thanks for giving it some thought! I'm also unsurprised to hear you're considering performance, I noticed capsicain was very responsive. I wouldn't want to interfere with that.

A common example for me would be that I use the 'forward' button on the side of the mouse, as the 'ctrl' key. Handy for all those things that need ctrl+click or ctrl+drag, when my left hand decides it doesn't want to act right. Similarly, the 'back' button is my 'shift' key. I'd really like to be able to fire off mouse events with my left hand, or swap around mouse buttons for when one finger decides today is not a good day. I can't do that so far, but it's part of the pipe dream. I get joint/tendon problems that flare up seemingly at random so some days I ought not be using a certain limb/digit/etc but I'm otherwise good to go. Being able to map a mouse button to the space bar would be a boon, having a busted left thumb really ruins my day for hitting space ;)

You mentioned mapping keys to real/virtual keys, it may be worth a mention that I use some of the F13-F24 keys on my extra mouse buttons so that those buttons are visible to the system despite not being actual mouse buttons. I don't know if that might interfere?

bitoj commented 3 years ago

Regarding F24:

For convenience and to avoid misunderstandings (especially when assigning unused scancodes for mouse keys) it would be an improvement to add F24 to the list of defined keys, to replace SC_0x76.