pantherattack
October 26th, 2009, 10:08 PM
Hi,
I don't know any of the syntax, but I pieced together a shell script from different sources. It's to toggle the output to the headphone jack on the front of my computer.
#/bin/bash
state=$(amixer sget 'Headphone',0 | grep '\[on\]' -c)
if [ "$state" == "2" ]
then
amixer sset 'Headphone',0 off
else
amixer sset 'Headphone',0 on
fi
exit 0
It works from command line (ie. running ./toggle_headphones.sh), but when I try to associate the script to a keyboard shortcut (tried a few including Alt-2, Alt-H, and my special email button) in System->Preferences->Keyboard Shortcuts, but it doesn't work. But I have gotten other shell scripts to run from a keyboard short cut.
Any ideas?
Ian
I don't know any of the syntax, but I pieced together a shell script from different sources. It's to toggle the output to the headphone jack on the front of my computer.
#/bin/bash
state=$(amixer sget 'Headphone',0 | grep '\[on\]' -c)
if [ "$state" == "2" ]
then
amixer sset 'Headphone',0 off
else
amixer sset 'Headphone',0 on
fi
exit 0
It works from command line (ie. running ./toggle_headphones.sh), but when I try to associate the script to a keyboard shortcut (tried a few including Alt-2, Alt-H, and my special email button) in System->Preferences->Keyboard Shortcuts, but it doesn't work. But I have gotten other shell scripts to run from a keyboard short cut.
Any ideas?
Ian