toggle volume with scroll wheel in X on freeBSD ?

Louis LeBlanc FreeBSD at
Wed Jul 6 14:18:11 GMT 2005

On 07/05/05 10:06 PM, Joe Schmoe sat at the `puter and typed:
> Hello,
> WHen I used to use windows, a very favorite app I used
> was:
> Very simple - if you held down control, then the mouse
> scroll wheel caused master volume to go up and down. 
> It was terrific.
> Is there a way to do this in X on FreeBSD ?  I would
> really like this functionality again...any thoughts ?

That would be pretty easy to do with any window manager that allows
you to set key/mouse macros.  I use Fvwm2, I'm sure others on the list
will tell you they prefer others - it's a matter of taste, so you
probably want to check out a few if you're new away from windoze.

For Fvwm2, I would simply set a macro for the "buttons" associated
with the scroller (usually 4 and 5) with the Ctrl modifier.  Something
like this (untested):

Mouse 4         A          C         Exec /usr/sbin/mixer pcm -1:-1
Mouse 5         A          C         Exec /usr/sbin/mixer pcm +1:+1

These macros start with the button to be configured (in XFree86 and
Xorg, the scroll up and down are classified as button pushes).  Next
is the context.  For Fvwm, 'A' means anwhere.  'R' means root window,
so you could use that to make it only work if your mouse is over the
root window, as opposed to an application window.  Next is the
modifier.  There are several of these, but 'C' means Ctrl.  Exec is
the action, and the rest is the parameter to Exec, which basically
tells Fvwm what to run when you hit that combination of buttons.  I'm
sure most WMs allow some kind of key bindings to be configured, so
look into the config docs for your WM.

Personally, I use a wireless keyboard from a great little hardware
company called Microsoft (I know, they think they're a software
company).  It's got some fancy buttons along the top for all kinds of
stuff.  I've used the above method to tie those buttons to things like
volume control as described above.  I even wrote a quick little script
to mute the volume and save the old volume for resetting, then tied
the script to my mute button.

Before you use the commands above for your WM config, check them at
the command line (without the "Exec") to make sure they work.  You
might boost the mod value to get more immediate results - the 1
translates to 1% of the total volume range.

Louis LeBlanc                          FreeBSD-at-keyslapper-DOT-net
Fully Funded Hobbyist,                   KeySlapper Extrordinaire :)
Please send off-list email to:         leblanc at keyslapper d.t net
Key fingerprint = C5E7 4762 F071 CE3B ED51  4FB8 AF85 A2FE 80C8 D9A2

Harrisberger's Fourth Law of the Lab:
  Experience is directly proportional to the amount of equipment ruined.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list