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

37 lines
948 B
Bash
Raw Normal View History

2024-01-05 12:56:52 -05:00
#!/bin/bash
_getHeader "$name" "$author"
echo "Hide or show the chatgpt icon in ML4W waybar themes."
# Define File
targetFile="$HOME/dotfiles/waybar/modules.json"
settingsFile="$HOME/dotfiles/.settings/waybar_chatgpt"
# Define Markers
startMarker="START CHATGPT TOOGLE"
endMarker="END CHATGPT TOOGLE"
# Select Value
2024-01-11 10:03:36 -05:00
customvalue=$(gum choose "SHOW" "HIDE" "DEFAULT")
2024-01-05 12:56:52 -05:00
if [ ! -z $customvalue ]; then
if [ "$customvalue" == "SHOW" ] ;then
customtext=" \"custom\/chatgpt\","
2024-01-11 10:03:36 -05:00
elif [ "$customvalue" == "DEFAULT" ] ;then
customtext=" \"custom\/chatgpt\","
2024-01-05 12:56:52 -05:00
else
customtext=" \/\/\"custom\/chatgpt\","
fi
_replaceInFile $startMarker $endMarker $customtext $targetFile
_writeSettings $settingsFile $customtext
# Reload Waybar
setsid $HOME/dotfiles/waybar/launch.sh 1>/dev/null 2>&1 &
_goBack
else
echo "ERROR: Define a value."
sleep 2
_goBack
fi