From 4de766c6c7476586924e041bb0ad81a2e6b4abd1 Mon Sep 17 00:00:00 2001 From: NeodarZ Date: Mon, 21 Aug 2017 16:21:53 +0200 Subject: Add option to configure the sinkport --- i3/.config/i3/config | 2 +- i3/.config/i3/switch_audio.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'i3') diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 9715d04..4d3d403 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -114,7 +114,7 @@ bindsym $WinKey+Shift+F8 exec terminator -e qutebrowser bindsym $WinKey+control+l exec i3lock-fancy bindsym $WinKey+p exec passmenu #bindsym $WinKey+Shift+$AltKey+0 exec ~/.config/i3/switch-workspace.py 6 -bindsym XF86AudioPlay exec ~/.config/i3/switch_audio.sh +bindsym XF86AudioPlay exec ~/.config/i3/switch_audio.sh 8 # start a terminal bindsym $WinKey+Return exec qterminal diff --git a/i3/.config/i3/switch_audio.sh b/i3/.config/i3/switch_audio.sh index ee8531a..aff2543 100755 --- a/i3/.config/i3/switch_audio.sh +++ b/i3/.config/i3/switch_audio.sh @@ -1,12 +1,16 @@ #/bin/sh +# Usage : +# switch_audio.sh + headphones="analog-output-headphones" lineout="analog-output-lineout" +sinkport="$1" if [[ $(echo $(pacmd list | grep "active port") | cut -d" " -f3 | cut -d"<" -f2 | cut -d">" -f1) == $lineout ]] then - pacmd set-sink-port 0 $headphones + pacmd set-sink-port $sinkport $headphones elif [[ $(echo $(pacmd list | grep "active port") | cut -d" " -f3 | cut -d"<" -f2 | cut -d">" -f1) == $headphones ]] then - pacmd set-sink-port 0 $lineout + pacmd set-sink-port $sinkport $lineout fi -- cgit v1.2.1