# Simulating the wheel on the mouse.



## shuxuef (May 6, 2010)

I believe there is a way to simulate the middle wheel using other buttons of the mouse or using a combination of keyboard and mouse. But I couldn't figure it out after some searching. Can anybody help me with this? Thanks!


----------



## paean (May 6, 2010)

You should be able to capture the mouse button code with xev(1) and simulate it by using xbindkeys(1).


----------



## phoenix (May 7, 2010)

Middle button click?  Or scroll wheel up/down?

For the former, if you are using moused, you can add *-3* to *moused_flags* in /etc/rc.conf.  After reloading moused, pressing both mouse buttons at the same time will register as a middle button click.

For the latter, just use the Page Up and Page Down buttons on the keyboard.


----------



## shuxuef (May 7, 2010)

phoenix said:
			
		

> Middle button click?  Or scroll wheel up/down?
> 
> For the former, if you are using moused, you can add *-3* to *moused_flags* in /etc/rc.conf.  After reloading moused, pressing both mouse buttons at the same time will register as a middle button click.
> 
> For the latter, just use the Page Up and Page Down buttons on the keyboard.



Thanks, phoenix. I meant the latter, simulating/emulating the scroll action of the wheel. More exactly, I wish I could translate the y-axis movement into z-axis movement, after probably adding a CTRL key.

As far as I know, moused doesn't work in X, it only works in text-based consoles.  Using PgUp/PgDn is not an ideal solution; first, it cannot bring the desired window into focus, second, it's still not working under some circumstances, e.g. the zooming function in some applications.


----------



## Beastie (May 7, 2010)

moused works perfectly anywhere.

I use the middle button click in Opera to search using the default search engine, and I use the scroll wheel to move any scollbar up and down, and to shade/unshade windows.


----------



## phoenix (May 7, 2010)

shuxuef said:
			
		

> Thanks, phoenix. I meant the latter, simulating/emulating the scroll action of the wheel. More exactly, I wish I could translate the y-axis movement into z-axis movement, after probably adding a CTRL key.
> 
> As far as I know, moused doesn't work in X, it only works in text-based consoles.



moused works just fine in X.  You just configure X to use */dev/sysmouse* as the mouse device.



> Using PgUp/PgDn is not an ideal solution; first, it cannot bring the desired window into focus,



The scroll wheel in an inactive window doesn't bring that window into focus either.

It's one of the things I like about the X scroll wheel functionality, compared to the MS Intellimouse scroll wheel which only works on active windows.

You can put the mouse pointer over any window, and scroll it, regardless of whether it's active or not.



> second, it's still not working under some circumstances, e.g. the zooming function in some applications.



That's different, yeah.


----------



## aragon (May 7, 2010)

shuxuef said:
			
		

> I wish I could translate the y-axis movement into z-axis movement, after probably adding a CTRL key.


Have a look at moused(8) and the -V, -H, -U, and -L arguments.  Sounds like you want virtual scrolling, which works such that when you hold down the middle button moused translates your Y-axis into the Z-axis (buttons 4 and 5).


----------



## shuxuef (May 8, 2010)

aragon said:
			
		

> Have a look at moused(8) and the -V, -H, -U, and -L arguments.  Sounds like you want virtual scrolling, which works such that when you hold down the middle button moused translates your Y-axis into the Z-axis (buttons 4 and 5).



Is it possible not to use the middle button at all, e.g. on a 2-button mouse? Is it possible to emulate the middle wheel action using the keyboard? (I don't want to use NumLock, my NumLock is not working anyway.) Thanks!


----------



## aragon (May 8, 2010)

shuxuef said:
			
		

> Is it possible not to use the middle button at all, e.g. on a 2-button mouse? Is it possible to emulate the middle wheel action using the keyboard? (I don't want to use NumLock, my NumLock is not working anyway.) Thanks!


Not without modifying moused's source.


----------

