From 8e0518c41742028346d5bcb12f956fa54c4912b5 Mon Sep 17 00:00:00 2001 From: Stephan Raabe Date: Fri, 5 Jan 2024 18:56:52 +0100 Subject: [PATCH] Add ChatGPT Icon --- .install/restore.sh | 11 ++++++ .../settings/modules/waybar/chatgpt/config.sh | 2 ++ .../settings/modules/waybar/chatgpt/module.sh | 34 +++++++++++++++++++ waybar/modules.json | 3 ++ 4 files changed, 50 insertions(+) create mode 100644 hypr/settings/modules/waybar/chatgpt/config.sh create mode 100755 hypr/settings/modules/waybar/chatgpt/module.sh diff --git a/.install/restore.sh b/.install/restore.sh index 6a3f9ea..feda8bb 100755 --- a/.install/restore.sh +++ b/.install/restore.sh @@ -207,6 +207,17 @@ echo -e "${NONE}" echo "Waybar Appslabel restored." fi + # Restore Waybar ChatGPT + targetFile="$HOME/dotfiles/waybar/modules.json" + settingsFile="$HOME/dotfiles/.settings/waybar_chatgpt" + if [ -f $settingsFile ] ;then + startMarker="START CHATGPT TOOGLE" + endMarker="END CHATGPT TOOGLE" + customtext="$(cat $settingsFile)" + _replaceInFile "$startMarker" "$endMarker" "$customtext" "$targetFile" + echo "Waybar ChatGPT restored." + fi + # Restore Waybar Bluetooth targetFile1="$HOME/dotfiles-versions/$version/waybar/themes/ml4w/config" targetFile2="$HOME/dotfiles-versions/$version/waybar/themes/ml4w-blur/config" diff --git a/hypr/settings/modules/waybar/chatgpt/config.sh b/hypr/settings/modules/waybar/chatgpt/config.sh new file mode 100644 index 0000000..476b24d --- /dev/null +++ b/hypr/settings/modules/waybar/chatgpt/config.sh @@ -0,0 +1,2 @@ +name="Show/Hide ChatGPT" +order=1 diff --git a/hypr/settings/modules/waybar/chatgpt/module.sh b/hypr/settings/modules/waybar/chatgpt/module.sh new file mode 100755 index 0000000..a19f8cb --- /dev/null +++ b/hypr/settings/modules/waybar/chatgpt/module.sh @@ -0,0 +1,34 @@ +#!/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 +customvalue=$(gum choose "SHOW" "HIDE") + +if [ ! -z $customvalue ]; then + if [ "$customvalue" == "SHOW" ] ;then + customtext=" \"custom\/chatgpt\"," + 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 diff --git a/waybar/modules.json b/waybar/modules.json index 7ef218a..2fe82dc 100644 --- a/waybar/modules.json +++ b/waybar/modules.json @@ -276,6 +276,9 @@ "group/quicklinks": { "orientation": "horizontal", "modules": [ + // START CHATGPT TOOGLE + "custom/chatgpt", + // END CHATGPT TOOGLE "custom/filemanager", "custom/browser" ]