mpapis / home_dotfiles

my personal dotfiles from my $HOME dir
16 stars 3 forks source link

Add a zenity gui for comfortable output selection in mypa #1

Closed M-Bab closed 9 years ago

M-Bab commented 9 years ago

After a bit of fighting with pulse your script helped me a lot. I extended it a bit by a zenity gui selector which makes switching output more comfortable and usable with starters or shortcuts.

Cheers, Martin

57a58,81
> function switch_gui()
> {
>    current_id=$(pacmd list-sinks | egrep '\* index:' | egrep -o '[0-9]+$')
>    ids=( $(pacmd list-sinks | egrep 'index:' | egrep -o '[0-9]+$' | tr '\n' ' ') )
>    names=( $(pacmd list-sinks | egrep 'name:' | egrep -o '\..*>$' | tr -d '>' | tr '\n' ' ') )
> 
>    zen_pars="--list --radiolist --column '' --column 'ID' --column 'Sink_name'"
> 
>    for i in "${!ids[@]}"
>    do
>       if [ ${ids[$i]} = $current_id ]; then
>          zen_pars="$zen_pars TRUE"
>       else
>          zen_pars="$zen_pars FALSE"
>       fi
>       zen_pars="$zen_pars ${ids[$i]} ${names[$i]}"
>    done
> 
>    new_sink_id=$(zenity $zen_pars || echo "")
>    if [ -n $new_sink_id ]; then
>       switch_sink $new_sink_id
>    fi
> }
> 
60c84
<   echo "Usage: $0 [|list|<sink name to switch to>]"

---
>   echo "Usage: $0 [gui|list|<sink name to switch to>]"
65a90
>   (gui)     switch_gui       ;;
67a93
>
mpapis commented 9 years ago

hi, sorry for slow answer - just got back from conferences, I will be reviewing this in the evening

mpapis commented 9 years ago

now I'm being really slow, it's still waiting on me, could you open a pull request and add some basic comments to all the functions?

M-Bab commented 9 years ago

Ok done ;-)