2023-12-18 20:57:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
_getHeader "$name" "$author"
|
|
|
|
|
2023-12-26 09:56:06 +00:00
|
|
|
echo "Hide or show the bluetooth icon in ML4W waybar themes."
|
2023-12-18 20:57:32 +00:00
|
|
|
|
|
|
|
# Define File
|
2023-12-19 09:32:43 +00:00
|
|
|
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"
|
2023-12-18 20:57:32 +00:00
|
|
|
|
2023-12-19 09:32:43 +00:00
|
|
|
if [ ! -f $targetFile1 ] || [ ! -f $targetFile2 ] || [ ! -f $targetFile3 ] || [ ! -f $targetFile4 ] ;then
|
2023-12-18 20:57:32 +00:00
|
|
|
echo "ERROR: Target file not found."
|
|
|
|
sleep 2
|
|
|
|
_goBack
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Define Markers
|
|
|
|
startMarker="\/\/ START BT TOOGLE"
|
|
|
|
endMarker="\/\/ END BT TOOGLE"
|
|
|
|
|
|
|
|
# Define Replacement Template
|
|
|
|
customtemplate="VALUE\"bluetooth\","
|
|
|
|
|
|
|
|
# Select Value
|
|
|
|
customvalue=$(gum choose "SHOW" "HIDE")
|
|
|
|
|
|
|
|
if [ ! -z $customvalue ]; then
|
|
|
|
if [ "$customvalue" == "SHOW" ] ;then
|
|
|
|
customvalue=""
|
|
|
|
else
|
|
|
|
customvalue="//"
|
|
|
|
fi
|
2023-12-19 15:48:01 +00:00
|
|
|
|
2023-12-18 20:57:32 +00:00
|
|
|
# Replace in Template
|
|
|
|
customtext="${customtemplate/VALUE/"$customvalue"}"
|
|
|
|
|
2023-12-19 15:48:01 +00:00
|
|
|
_replaceInFile $startMarker $endMarker $customtext $targetFile1
|
|
|
|
_replaceInFile $startMarker $endMarker $customtext $targetFile2
|
|
|
|
_replaceInFile $startMarker $endMarker $customtext $targetFile3
|
|
|
|
_replaceInFile $startMarker $endMarker $customtext $targetFile4
|
|
|
|
|
|
|
|
# Reload Waybar
|
|
|
|
setsid $HOME/dotfiles/waybar/launch.sh 1>/dev/null 2>&1 &
|
|
|
|
_goBack
|
2023-12-18 20:57:32 +00:00
|
|
|
else
|
|
|
|
echo "ERROR: Define a value."
|
|
|
|
sleep 2
|
|
|
|
_goBack
|
|
|
|
fi
|