Wandering Thoughts archives


The convenience of having keyboard controls for sound volume

For a long time now, many keyboards have come with various additional keys over and above the traditional set. First it was Windows keys, and then people started adding various 'multimedia' keys and buttons for things. For an equally long time I used a very minimal keyboard without such keys, so I rolled my eyes a little bit at the indulgence (and the wasted space) and otherwise ignored the issue of keyboard 'multimedia' control. Even when I recently got a keyboard that sort of had these keys, I initially kept ignoring them and the whole issue; it was easy enough to reach out to the appropriate speaker to fiddle the volume, or maybe call up the applet I have sitting there for general volume control.

It turns out that I was kind of being a fool about this (as usual). Having keys that I wasn't actually using nagged at me a bit, and recently I got just irritated enough with reaching for the volume control to figure out how to wire up these keys to do something. The first thing I learned is that it turned out to be relatively easy; there are command line tools that will let you control volume, these keys generated distinct keycodes, and they were easily bound to actions in fvwm. My current setup is:

Key XF86AudioRaiseVolume   A N   Exec amixer -q set Master '2%+'
Key XF86AudioLowerVolume   A N   Exec amixer -q set Master '2%-'
Key XF86AudioMute          A N   Exec amixer -q set Master toggle

(Some of my sources when I researched this include here, here, and here. Some of these also give the pactl equivalents of my amixer commands. See also this little GUI tool (via), although I actually use the old Gnome volume control applet from Fedora 14, which miraculously hasn't broken yet.)

When I set this up, I expected this to be basically a curio. As you may have gathered, I was wrong; the keyboard keys have rapidly become my primary method of doing volume control. It's not because they're any better than turning the volume knob or moving the volume slider up or down (in some ways they're worse). It's because they're significantly more convenient, because my hands are usually right there on the keyboard and volume shifts are thus just a quick tap away. As small as it seems, not having to reach for the volume knob or the mouse really does make a palpable difference for how things feel. Even if it's a little bit of work to shift my hand, it's less work, less interruption, and less annoyance, and I like all of that.

(The convenience of having a mute/unmute was especially a surprise. It's now trivial to mute sound if I'm watching some Youtube video just to see it, and as a result I do it fairly often.)

As a side note, I arrived at a 2% volume change per keypress partly by experimentation about what felt good and partly by observing that it's easy to rapidly repeat a keypress, so small changes were probably better than big ones. Also, I keep my sound volumes rather low so small changes in nominal volume can have clearly audible effects.

linux/LinuxVolumeKeys written at 00:09:54; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.