Skip to content

Instantly share code, notes, and snippets.

@alsemo
Created September 8, 2011 03:33
Show Gist options
  • Save alsemo/1202541 to your computer and use it in GitHub Desktop.
Save alsemo/1202541 to your computer and use it in GitHub Desktop.
/usr/local/share/scrotwm/audioout.sh
# My scrotwm config
# Programs
program[swap_audio] = /usr/local/share/scrotwm/audioout.sh
# Key Bindings
bind[swap_audio] = MOD+Shift+a
#!/bin/sh
#
# audioout.sh - Ahmad Zulkarnain 08/09/11
# Script to alternate between audio master output and phone output.
# Will be used by scrotwm. Copy to /usr/local/share/scrotwm/
# and alter ~/.scrotwm.conf accordingly.
# Variables for audio status
master=$(mixerctl | grep master.mute | sed s/.*=//)
phout=$(mixerctl | grep phone.mute | sed s/.*=//)
# Program starts
if [[ $master == 'on' ]];
then
mixerctl outputs.master.mute=off;
mixerctl outputs.hp.mute=on;
elif [[ $phout == 'on' ]];
then
mixerctl outputs.master.mute=on;
mixerctl outputs.hp.mute=off;
else
mixerctl outputs.master.mute=off;
mixerctl outputs.hp.mute=on;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment