parent
bde6813732
commit
4be0ce5899
@ -0,0 +1,46 @@ |
||||
#!/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). |
||||
# |
||||
# 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 |
||||
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 |
||||
|
Loading…
Reference in new issue