Skip to content

Instantly share code, notes, and snippets.

@avuserow
Created February 23, 2011 16:21
Show Gist options
  • Save avuserow/840644 to your computer and use it in GitHub Desktop.
Save avuserow/840644 to your computer and use it in GitHub Desktop.
script to change volume on thinkpads, and also synchronize the hardware mute with the software mute. First argument is up to raise by 10%, down to lower by 10%, or no argument to just automatically mute/unmute.
#!/bin/sh
MUTED=`perl -lne'print (/mute:\s+(\w+)/) if /mute:/' < /proc/acpi/ibm/volume`
# default to muted if the state is unknown
if [ "${MUTED}" == "off" ] ; then
amixer set Master on -q
else
amixer set Master off -q
fi
if [ "$1" == "up" ]; then
amixer set Master 10%+ -q
fi
if [ "$1" == "down" ]; then
amixer set Master 10%- -q
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment