Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do I start making a linux input hack?

When you hold "shift" and scroll with your mouse on a mac, it interprets your vertical scroll motion into horizontal scroll actions. This is my most missed feature when working on linux, and I would love to bring it to linux (since I have looked thoroughly and nobody else seems to have done so yet).

I hope this can be done with some sort of runtime plugin, or at least in a way that doesn't require me to recompile all my other applications for them to make use of the functionality. My question is: What libraries out there would allow such a plugin to be written? Writing some sort of script would be nice, as it doesn't seem like the functionality should be that complex, but I can code in C and C++ if need be.

I have looked into X solutions like XEvIE (discontinued) and XTrap (similarly abandoned, it seems). I would be happy to restrict myself to GTK / GNOME only for now, at least as a proof of concept.

If this can't be done as a plugin, which open-source project should I approach (Xfree86? GNOME? someone else?) to try and get this functionality into?

-- update (with a solution!):

install the packages "xbindkeys" and "xautomation". Then write the following in your ~/.xbindkeysrc.scm file:

; bind shift + vertical scroll to horizontal scroll events
(xbindkey '(shift "b:4") "xte 'mouseclick 6'")
(xbindkey '(shift "b:5") "xte 'mouseclick 7'")

then just run xbindkeys

like image 975
gfxmonk Avatar asked Jul 24 '09 00:07

gfxmonk


1 Answers

I am not sure but evdev can do things like this. For example it can simulate keyboard presses when a mouse button (scroll up/down is also a button) is pressed. It might be possible to do horizontal scrolling (possibly with keyboard left/right arrows?).

like image 159
stribika Avatar answered Sep 21 '22 22:09

stribika