#!/usr/bin/env bash ############################################################################## # # pulse-fzf-autoconf # By Steven Saus # (c) 2022; licensed under the MIT license # # simply allows quick switching of pulse-autoconf from either fzf or # from command line switches (e.g. for use with Openbox, etc). Example OpenBox # menu at the end of this file. # # Default presets from pulse-autoconf v 1.5.1 are # # preset="EchoCancellation" # preset="EchoCancellationWithSourcesMix" # preset="EchoCancellationPlacebo" # preset="None" # # No error-checking is done for direct input # # You can find pulse-autoconf at # https://eomanis.duckdns.org/permshare/pulse-autoconf # ############################################################################## ConfigFile=$HOME/.config/pulse-autoconf/pulse-autoconf.conf if [ ! -f "${ConfigFile}" ];then exit 99 fi if [ -z "$1" ];then AllPreset=$(grep "preset=" "${ConfigFile}" | awk -F '"' '{print $2}') CurrentPreset=$(grep "preset=" "${ConfigFile}" | grep -v -e "^#" | awk -F '"' '{print $2}') DesiredPreset=$(echo "${AllPreset}" | fzf) else CurrentPreset=$(grep "preset=" "${ConfigFile}" | grep -v -e "^#" | awk -F '"' '{print $2}') DesiredPreset="$1" fi # If they're the same, do nothing. if [ "${CurrentPreset}" != "${DesiredPreset}" ];then sed -i "s|preset=\"${CurrentPreset}\"|#preset=\"${CurrentPreset}\"|" "${ConfigFile}" sed -i "s|#preset=\"${DesiredPreset}\"|preset=\"${DesiredPreset}\"|" "${ConfigFile}" fi ############################################################################### # Example Openbox Menu # # # # # # # # /home/steven/bin/pulse-fzf-autoconf None# # # # # # # # # # # # # # /home/steven/bin/pulse-fzf-autoconf EchoCancellation# # # # # # # # # # # # # # /home/steven/bin/pulse-fzf-autoconf EchoCancellationWithSourcesMix# # # # # # # # #