diff options
| author | JaKooLit <ejhay.games@gmail.com> | 2025-03-18 18:39:27 +0900 |
|---|---|---|
| committer | JaKooLit <ejhay.games@gmail.com> | 2025-03-18 18:39:27 +0900 |
| commit | d1942b1206b8debe1d8672a756750b9ff4f4e802 (patch) | |
| tree | c96f924a81f52cc3228bf7b395507821324450bc | |
| parent | 51b04af8b39201a86d1c095bde51d4019ccef796 (diff) | |
Improved rofi Search.sh without using /tmp file
| -rw-r--r-- | config/hypr/UserConfigs/01-UserDefaults.conf | 2 | ||||
| -rwxr-xr-x | config/hypr/scripts/RofiSearch.sh | 30 |
2 files changed, 21 insertions, 11 deletions
diff --git a/config/hypr/UserConfigs/01-UserDefaults.conf b/config/hypr/UserConfigs/01-UserDefaults.conf index 6949d277..ae510f82 100644 --- a/config/hypr/UserConfigs/01-UserDefaults.conf +++ b/config/hypr/UserConfigs/01-UserDefaults.conf @@ -10,7 +10,7 @@ # script will take the default EDITOR and nano as fallback $edit=${EDITOR:-nano} -# This two is for UserKeybinds.conf +# These two are for UserKeybinds.conf & Waybar Modules $term = kitty # Terminal $files = thunar # File Manager diff --git a/config/hypr/scripts/RofiSearch.sh b/config/hypr/scripts/RofiSearch.sh index aa20546d..4218bed3 100755 --- a/config/hypr/scripts/RofiSearch.sh +++ b/config/hypr/scripts/RofiSearch.sh @@ -2,13 +2,26 @@ # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## # For Searching via web browsers -# Modify this config file for default search engine -config_file="$HOME/.config/hypr/UserConfigs/01-UserDefaults.conf" +# Define the path to the config file +config_file=$HOME/.config/hypr/UserConfigs/01-UserDefaults.conf -tmp_config_file=$(mktemp) -sed 's/^\$//g; s/ = /=/g' "$config_file" > "$tmp_config_file" -source "$tmp_config_file" -# ##################################### # +# Check if the config file exists +if [[ ! -f "$config_file" ]]; then + echo "Error: Configuration file not found!" + exit 1 +fi + +# Process the config file in memory, removing the $ and fixing spaces +config_content=$(sed 's/\$//g' "$config_file" | sed 's/ = /=/') + +# Source the modified content directly from the variable +eval "$config_content" + +# Check if $term is set correctly +if [[ -z "$Search_Engine" ]]; then + echo "Error: \$Search_Engine is not set in the configuration file!" + exit 1 +fi # Rofi theme and message rofi_theme="$HOME/.config/rofi/config-search.rasi" @@ -20,7 +33,4 @@ if pgrep -x "rofi" >/dev/null; then fi # Open Rofi and pass the selected query to xdg-open for Google search -echo "" | rofi -dmenu -config "$rofi_theme" -mesg "$msg" | xargs -I{} xdg-open $Search_Engine - -# Clean up temporary file after sourcing -rm "$tmp_config_file"
\ No newline at end of file +echo "" | rofi -dmenu -config "$rofi_theme" -mesg "$msg" | xargs -I{} xdg-open $Search_Engine
\ No newline at end of file |
