Created
January 30, 2017 16:25
-
-
Save jfontan/5e1c2904898339bb9584c9414f716199 to your computer and use it in GitHub Desktop.
change sound card
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sound_card=$1 | |
if [ -z "$sound_card" ]; then | |
echo "A sound card must be specified" | |
fi | |
pacmd set-default-sink "$sound_card" | |
clients=$(pacmd list-sink-inputs | grep -E "^\s+index:" | awk '{print $2}') | |
for client in $clients; do | |
pacmd move-sink-input "$client" "$sound_card" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sound_internal_id="alsa_output.pci-0000_00_1b.0.analog-stereo" | |
sound_monitor_id="alsa_output.pci-0000_00_03.0.hdmi-stereo" | |
sound_bar_id="alsa_output.usb-Dell_Dell_AC511_USB_SoundBar-00.analog-stereo" | |
lock=" lock" | |
suspend=" suspend" | |
shutdown=" shutdown" | |
solo=" solo" | |
home=" home" | |
office=" office" | |
sound_internal=" internal audio" | |
sound_monitor=" monitor audio" | |
sound_bar=" bar audio" | |
options="$lock | |
$suspend | |
$shutdown | |
$solo | |
$office | |
$sound_internal | |
$sound_monitor | |
$sound_bar" | |
opt=$(echo "$options" | rofi -dmenu -font "hermit 20" -sidebar-mode) | |
[ $? = 1 ] && exit | |
case $opt in | |
$lock) | |
# i3lock | |
slock | |
;; | |
$suspend) | |
# i3lock | |
# systemctl suspend | |
slock systemctl suspend | |
;; | |
$shutdown) | |
systemctl poweroff | |
;; | |
$solo) | |
~/.screenlayout/solo.sh | |
i3-msg restart | |
;; | |
$home) | |
~/.screenlayout/casa.sh | |
i3-msg restart | |
;; | |
$office) | |
~/.screenlayout/oficina.sh | |
i3-msg restart | |
;; | |
$sound_internal) | |
~/bin/change_sound_card "$sound_internal_id" | |
;; | |
$sound_monitor) | |
~/bin/change_sound_card "$sound_monitor_id" | |
;; | |
$sound_bar) | |
~/bin/change_sound_card "$sound_bar_id" | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment