Hyprland-dotfiles/hypr/settings/modules/waybar/bluetooth/module.sh

41 lines
1.2 KiB
Bash
Raw Normal View History

2023-12-18 15:57:32 -05:00
#!/bin/bash
_getHeader "$name" "$author"
2023-12-26 04:56:06 -05:00
echo "Hide or show the bluetooth icon in ML4W waybar themes."
2023-12-18 15:57:32 -05:00
# Define File
2023-12-19 04:32:43 -05: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-27 17:19:24 -05:00
settingsFile="$HOME/dotfiles/.settings/waybar_bluetooth"
2023-12-18 15:57:32 -05:00
# Define Markers
2023-12-27 17:19:24 -05:00
startMarker="START BT TOOGLE"
endMarker="END BT TOOGLE"
2023-12-18 15:57:32 -05:00
# Select Value
customvalue=$(gum choose "SHOW" "HIDE")
if [ ! -z $customvalue ]; then
if [ "$customvalue" == "SHOW" ] ;then
2023-12-27 17:19:24 -05:00
customtext=" \"bluetooth\","
2023-12-18 15:57:32 -05:00
else
2023-12-27 17:19:24 -05:00
customtext=" \/\/\"bluetooth\","
2023-12-18 15:57:32 -05:00
fi
2023-12-19 10:48:01 -05:00
_replaceInFile $startMarker $endMarker $customtext $targetFile1
_replaceInFile $startMarker $endMarker $customtext $targetFile2
_replaceInFile $startMarker $endMarker $customtext $targetFile3
_replaceInFile $startMarker $endMarker $customtext $targetFile4
2023-12-27 17:19:24 -05:00
_writeSettings $settingsFile $customtext
2023-12-19 10:48:01 -05:00
# Reload Waybar
setsid $HOME/dotfiles/waybar/launch.sh 1>/dev/null 2>&1 &
_goBack
2023-12-18 15:57:32 -05:00
else
echo "ERROR: Define a value."
sleep 2
_goBack
fi