This commit is contained in:
Stephan Raabe
2023-12-27 23:19:24 +01:00
parent 7a8de31afe
commit bd8fdde4d3
15 changed files with 282 additions and 148 deletions

View File

@@ -8,37 +8,27 @@ targetFile1="$HOME/dotfiles/waybar/themes/ml4w/config"
targetFile2="$HOME/dotfiles/waybar/themes/ml4w-blur/config"
targetFile3="$HOME/dotfiles/waybar/themes/ml4w-blur-bottom/config"
targetFile4="$HOME/dotfiles/waybar/themes/ml4w-bottom/config"
if [ ! -f $targetFile1 ] || [ ! -f $targetFile2 ] || [ ! -f $targetFile3 ] || [ ! -f $targetFile4 ] ;then
echo "ERROR: Target file not found."
sleep 2
_goBack
fi
settingsFile="$HOME/dotfiles/.settings/waybar_bluetooth"
# Define Markers
startMarker="\/\/ START BT TOOGLE"
endMarker="\/\/ END BT TOOGLE"
# Define Replacement Template
customtemplate="VALUE\"bluetooth\","
startMarker="START BT TOOGLE"
endMarker="END BT TOOGLE"
# Select Value
customvalue=$(gum choose "SHOW" "HIDE")
if [ ! -z $customvalue ]; then
if [ "$customvalue" == "SHOW" ] ;then
customvalue=""
customtext=" \"bluetooth\","
else
customvalue="//"
customtext=" \/\/\"bluetooth\","
fi
# Replace in Template
customtext="${customtemplate/VALUE/"$customvalue"}"
_replaceInFile $startMarker $endMarker $customtext $targetFile1
_replaceInFile $startMarker $endMarker $customtext $targetFile2
_replaceInFile $startMarker $endMarker $customtext $targetFile3
_replaceInFile $startMarker $endMarker $customtext $targetFile4
_writeSettings $settingsFile $customtext
# Reload Waybar
setsid $HOME/dotfiles/waybar/launch.sh 1>/dev/null 2>&1 &