From 3b13c6341075e6306dc469c068cf61f477a90ccd Mon Sep 17 00:00:00 2001 From: Kevin Mok Date: Wed, 19 Sep 2018 10:09:44 -0400 Subject: [PATCH] Added sink change script --- aliases/zsh_aliases | 15 +++++++++++++-- change-sink.sh | 18 ++++++++++++++++++ configs/i3/config | 5 ++++- 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100755 change-sink.sh diff --git a/aliases/zsh_aliases b/aliases/zsh_aliases index 68827d5..97eb7bb 100644 --- a/aliases/zsh_aliases +++ b/aliases/zsh_aliases @@ -104,6 +104,11 @@ function rt() { } # }}} rotate monitor # +# sound +alias vlm="alsamixer -c 0" +alias vlmh="alsamixer -c 3" + +# apt function apti() { sudo apt install $1 ; } function aptr() { sudo apt remove $1 ; } # }}} system # @@ -157,8 +162,6 @@ function auc() { xdotool click --repeat 1000000 --delay $1 1 ; } alias rsl="java -jar ~/Downloads/RuneLite.jar" alias vbn="cvlc --loop --alsa-gain 1 ~/Music/brown-noise.mp3" -alias vlm="alsamixer -c 0" -alias vlmh="alsamixer -c 3" alias rmsw="rm .sw*" # function rs(){ redshift -O $(echo "scale=2;$1*1000" | bc) ; } @@ -335,3 +338,11 @@ alias djs="python manage.py shell" # }}} # }}} coding projs # + +# school {{{ # + +alias sch="f ~/Documents/school" +alias sta="f ~/Documents/school/sta" +alias 236="f ~/Documents/school/236" + +# }}} school # diff --git a/change-sink.sh b/change-sink.sh new file mode 100755 index 0000000..0b4b49a --- /dev/null +++ b/change-sink.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +#Device name variable +if [ $1 = "dac" ]; then + devicename="alsa_output.usb-FiiO_DigiHug_USB_Audio-01.iec958-stereo" +elif [ $1 = "line-out" ]; then + devicename="alsa_output.pci-0000_00_14.2.analog-stereo" +fi +echo "$devicename" + +#change the default sink +pacmd "set-default-sink "$devicename"" + +#move all inputs to the new sink +for app in $(pacmd list-sink-inputs | sed -n -e 's/index:[[:space:]]\([[:digit:]]\)/\1/p'); +do + pacmd "move-sink-input $app "$devicename"" +done diff --git a/configs/i3/config b/configs/i3/config index bd51bd2..d2e98ef 100644 --- a/configs/i3/config +++ b/configs/i3/config @@ -154,7 +154,7 @@ bindsym Mod4+g workspace $ws5; layout stacking; exec steam set $ws6 "6 " workspace $ws6 output $samsung bindsym Mod4+d workspace $ws6; exec discord -bindsym Mod4+l workspace $ws6; exec slack +bindsym Mod4+k workspace $ws6; exec slack assign [class="Slack"] $ws6 set $ws7 "7 " @@ -305,6 +305,9 @@ font pango:Hack 11 # }}} mod key/font # # media keys {{{ # +bindsym $mod+d exec ~/linux-config/change-sink.sh dac +bindsym $mod+o exec ~/linux-config/change-sink.sh line-out + bindsym XF86AudioRaiseVolume exec --no-startup-id amixer -c 0 sset Master 3+ bindsym XF86AudioLowerVolume exec --no-startup-id amixer -c 0 sset Master 3- bindsym XF86AudioMute exec --no-startup-id amixer -D pulse set Master 0+ toggle